-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add V1 endpoints for factory, machine, machine_type #24
base: master
Are you sure you want to change the base?
Conversation
…e method to use v1 endpints defined
…ine and get_machine_type
… log error inplace of print
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could unit tests against https://demo-continuous.sightmachine.io/ be added? I think we can have basic username/password added to that tenant. We wouild just need to add the password for our list of secrets in repo, so if it needs to be changed we are aware of it.
A test using mocks against the requests library can be done with: https://requests-mock.readthedocs.io/en/latest/mocker.html |
…er_by with select and order_by, priorities with single char
Are we looking for new way of mocking request since monkeypatch of mock is already there or we are looking for an INTEGRATION test to test sdk code end to end for eg. `def test_get_machines(monkeypatch):
` in this code we are mocking, do we need to add more tests like this or do we need to use the sdk to test against demo-continuos from an end-user perspective? |
… the way exceptions were logged, add data type for check_kw, removed v0 endpoints
we are creating a separate ticket for this |
we are creating a separate ticket for this |
we are creating a separate ticket for this |
101a54e
to
e3a0631
Compare
smsdk/client.py
Outdated
if util_name in ['get_factories', 'get_machines', 'get_machine_types']: | ||
# data = dict_to_df(getattr(cls, util_name)(*args, **sub_kwargs[0]), normalize) | ||
return getattr(cls, util_name)(normalize, *args, **sub_kwargs[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, It it the way the current SDK is designed, but I dislike the need to need to inspect the method names to determine function signatures rather than leveraging the language and OO methods.
smsdk/client.py
Outdated
@@ -157,13 +160,17 @@ def get_data_v1(self, ename, util_name, normalize=True, *args, **kwargs): | |||
# dict params strictly follow {'key':'value'} format | |||
|
|||
# sub_kwargs = kwargs | |||
if util_name in ['get_cycles', 'get_downtime', 'get_parts']: | |||
if util_name in ['get_cycles', 'get_downtime', 'get_parts', 'get_factories', 'get_machines', 'get_machine_types']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit Tests are a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A useful combination of tools to see how well the code created has test coverage is:
- coverage
- diff-cover
ex.
coverage run -m pytest -vvv -s tests
coverage xml
diff-cover --compare-branch origin/master --html-report diff-report.html coverage.xml
xdg-open diff-report.html
The report given goes off the code vs the diff, but still useful.
I don't have any more comments on this. Approved |
# raise ValueError("Error - {}".format(records)) | ||
return records | ||
|
||
def modify_input_params(self, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be missing something but it seems like all of these modify_input_params are the same. Is there a reason this isn't a util you import?
@@ -278,3 +277,87 @@ def get_starttime_endtime_keys(self, **kwargs): | |||
continue | |||
|
|||
return starttime_key, endtime_key | |||
|
|||
def _get_records_mongo_v1( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does mongo in the function name mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this module kept around for? What v0 interfaces remain?
Hi, Please review the PR, Thanks
https://sightmachine.atlassian.net/browse/MARS-7090