Skip to content
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

Merged
merged 6 commits into from
Oct 20, 2023

Conversation

ankitintg
Copy link
Contributor

https://sightmachine.atlassian.net/browse/ENG-3029
Update get_machine and get_machine_type API's of SDK to use v1 endpoints (v1/obj/....)

@mrnthv mrnthv requested a review from mklein0 October 10, 2023 15:40
@mrnthv
Copy link
Contributor

mrnthv commented Oct 10, 2023

The unit tests are failing since the commit 1e992b9
We are looking into fixing them as part of ticket https://sightmachine.atlassian.net/browse/ENG-3115

@mrnthv
Copy link
Contributor

mrnthv commented Oct 16, 2023

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"
Copy link
Contributor

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?

Copy link
Contributor Author

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/machine/test_machine.py Show resolved Hide resolved
tests/machine_type/test_machine_type.py Show resolved Hide resolved
smsdk/config/api_endpoints.json Show resolved Hide resolved
Comment on lines 8 to 9
API_KEY = "5a73aa5a-1962-4df9-b56e-4a59462f0f00"
API_SECRETE = "sma_FajgH3VbPu68gwy0PzccvhyGRyy1a8CCHhhvy6ooeg1O_"
Copy link

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?

Copy link
Contributor Author

@ankitintg ankitintg Oct 19, 2023

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.

@ankitintg ankitintg requested a review from mklein0 October 19, 2023 11:43
@@ -4,26 +4,23 @@
},
"Cycle": {
"url_v1": "/v1/datatab/cycle",
"url": "/api/cycle",
"alt_url": "/api/cycle"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be removed?

@@ -4,26 +4,23 @@
},
"Cycle": {
"url_v1": "/v1/datatab/cycle",
"url": "/api/cycle",
"alt_url": "/api/cycle"
},
"Factory": {
"url" : "/api/factory"
Copy link

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

@ankitintg ankitintg merged commit 6cf0ba6 into master Oct 20, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants