-
Notifications
You must be signed in to change notification settings - Fork 34
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
Refactor/SK-1225 | Use api/v1 in APIClient start_session #758
Conversation
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.
Nice work! I left a comment.
}, | ||
verify=self.verify, | ||
headers=self.headers, | ||
) | ||
|
||
if response.status_code == 201: |
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.
Cool! An improvement could be to indicate to the user what has gone wrong if status code != 201.
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.
The method will return the result from the first request, so the user already has access to this information.
Setting the active helper in |
The function
start_session
now makes two POST requests in sequence instead of one:host_url/api/v1/sessions
- to create a sessionhost_url/api/v1/sessions/start
- to start the sessionThe 2nd request is made only if the 1st request returns status code 201, indicating that the session has been created, and the response from the 2nd request is returned. Otherwise, the response from the 1st request is returned.
Also, the method
set_active_model
in APIClient now sets the active helper based on the file extension of the seed model file used (".npz" -> numpyhelper, ".bin" -> binaryhelper)