-
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
Migrated v0 endpoints for machine and machine_type into v1/obj endpoint #41
Conversation
The unit tests are failing since the commit 1e992b9 |
Unit tests are fixed. @mklein0 do review and provide your comments so that we can proceed with merging. |
@@ -48,7 +48,9 @@ def dict_to_df(data, normalize=True): | |||
# machine type stats are list | |||
cols = [*data[0]] | |||
cols.remove("stats") | |||
df = json_normalize(data, "stats", cols, record_prefix="stats.") | |||
df = json_normalize( | |||
data, "stats", cols, record_prefix="stats.", errors="ignore" |
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.
Why are we ignoring errors here?
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.
While getting get_machine_types() with v1 endpoint we are getting part_types
in response but not always that's why we are getting the key error like this- KeyError: "Try running with errors='ignore' as key 'part_types' is not always present"
Do you think we can do something else to address this issue? like avoid part_types
from the response or just ignore the errors from json_normalize
function
tests/conftest.py
Outdated
API_KEY = "5a73aa5a-1962-4df9-b56e-4a59462f0f00" | ||
API_SECRETE = "sma_FajgH3VbPu68gwy0PzccvhyGRyy1a8CCHhhvy6ooeg1O_" |
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.
Should this be read from an environment variable and default to these values?
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.
Do we want to set the variable and access it from os.environ()
or should we just create const.py
or JSON file and access these variables from there?
Need your comment on this.
smsdk/config/api_endpoints.json
Outdated
@@ -4,26 +4,23 @@ | |||
}, | |||
"Cycle": { | |||
"url_v1": "/v1/datatab/cycle", | |||
"url": "/api/cycle", | |||
"alt_url": "/api/cycle" |
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.
Should this be removed?
smsdk/config/api_endpoints.json
Outdated
@@ -4,26 +4,23 @@ | |||
}, | |||
"Cycle": { | |||
"url_v1": "/v1/datatab/cycle", | |||
"url": "/api/cycle", | |||
"alt_url": "/api/cycle" | |||
}, | |||
"Factory": { | |||
"url" : "/api/factory" |
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.
This probably needs to be a separate ticket. Maybe related to https://sightmachine.atlassian.net/browse/ENG-3228
https://sightmachine.atlassian.net/browse/ENG-3029
Update get_machine and get_machine_type API's of SDK to use v1 endpoints (v1/obj/....)