-
Notifications
You must be signed in to change notification settings - Fork 1
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
56 update code to match new api spec #57
Conversation
@click.command("delete") | ||
@click.argument("output_id") | ||
@click.argument("file_id") | ||
def file_delete(output_id: str, file_id: str): |
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.
New deleting method.
cli_file.add_command(file_attach) | ||
cli_file.add_command(file_detach_all) | ||
|
||
cli_file.add_command(file_delete) |
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.
Added for CLI access.
@@ -221,8 +221,8 @@ def logout(self): | |||
def _upload_files_parallel( | |||
self, | |||
files: Union[str, Path, list], | |||
id: str, |
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.
attach_to
is renamed to id
everywhere now.
@@ -248,16 +248,17 @@ def _upload_files_parallel( | |||
# Do the parallel upload | |||
responses = None | |||
responses = meop.parallelise( | |||
self._upload_file, n, files=files, attach_to=attach_to, progress=progress | |||
self._upload_file, n, filepath=files, id=id, progress=progress |
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.
Passing the id over to the parallelise method.
|
||
return mu.ensure_list(responses) | ||
# return mu.ensure_list(responses) | ||
return responses | ||
|
||
def _upload_file( |
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.
_upload_files
was capable of uploading multiple files in the one payload, however, this was causing issues with return types (lists vs single objects) so it was simpler to make it the singular case. This is fine as the packet limit on the upload basically prevents uploading multiple files of any meaningful size anyway.
TL;DR - making this single-file made everything a lot simpler for the other methods which all call this.
self, id: str, files: list | ||
) -> Union[dict, requests.Response]: | ||
"""Attach files to a model output. | ||
def delete_file_from_model_output(self, id: str, file_id: str): |
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.
New delete method, turns 2 calls into 1
@@ -9,9 +9,10 @@ | |||
|
|||
# Files | |||
FILE_LIST = "modeloutput/{id}/files" | |||
FILE_UPLOAD = "upload" | |||
FILE_UPLOAD = FILE_LIST |
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.
new API endpoints
@@ -1,10 +1,11 @@ | |||
"""Test the CLI actions.""" |
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.
Updated all of the tests to make things work. Cleaned up docstrings, switched out for fixtures.
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.
LGTM. A simple typo-like comment since you were cleaning up the docstrings.
Co-authored-by: Claire Carouge <[email protected]>
A ridiculous amount of work to address the new API spec. I've been assured that any endpoint changes going forward will be namespaced (i.e. api/v1, api/v2 etc.) to avoid lengthy re-implementation delays.
I took this opportunity to improve docstrings etc. other comments will be written in-situ.
Let me know if anything is unclear.