Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Supporting Algo Management API's#18

Merged
besirkurtulmus merged 15 commits intomasteralgorithmiaio/algorithmia-python:masterfrom
api-clientalgorithmiaio/algorithmia-python:api-clientCopy head branch name to clipboard
Feb 27, 2019
Merged

Supporting Algo Management API's#18
besirkurtulmus merged 15 commits intomasteralgorithmiaio/algorithmia-python:masterfrom
api-clientalgorithmiaio/algorithmia-python:api-clientCopy head branch name to clipboard

Conversation

@besirkurtulmus
Copy link
Contributor

@besirkurtulmus besirkurtulmus commented Feb 26, 2019

The new methods are basically wrapper around the generated python client, that can be found here.

I've added the .create(), .update(), .publish(), .info(), .versions() & .compile() methods under client.algo().

Copy link
Contributor

@zeryx zeryx left a comment

Choose a reason for hiding this comment

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

Nothing too crazy, however much of the work seems to get performed in the algorithmia_api_client. It would be great to have that linked in here so we can see exactly how stuff gets executed.

if m is not None:
self.client = client
self.path = m.group(1)
self.username = self.path.split("/")[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it safe to assume here that the algorithm URI structure will always remain the same? Is there a world where this is brittle(supporting unicode algorithm names/usernames?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would assume that if the URI structure ever changes, line 19 would also break (which has been part of the client forever now).

Other than that point, I don't think we'll ever change it.

settingsObj = Settings(**settings)
createRequestVersionInfoObj = CreateRequestVersionInfo(**version_info)
update_parameters = {"details": detailsObj, "settings": settingsObj, "version_info": createRequestVersionInfoObj}
update_request = UpdateRequest(**update_parameters)
Copy link
Contributor

Choose a reason for hiding this comment

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

Small nit:
Some of your variables are camel case, and some are snake case - I think most of the time you snake case for dicts, but not always. Might be useful to be consistent here.

I think the python default is always snake case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Also as far as I can tell, the client has used both :/

Look at line 19-30. I could change the style for the code I wrote. I personally prefer using underscores. It makes reading the code easier.

Copy link

Choose a reason for hiding this comment

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

Per python style guide variables should be snake case:

https://www.python.org/dev/peps/pep-0008/#function-and-variable-names

Algorithmia/algorithm.py Show resolved Hide resolved
return api_response
except ApiException as e:
error_message = json.loads(e.body)["error"]["message"]
raise ApiError(error_message)
Copy link
Contributor

@kennydaniel kennydaniel Feb 27, 2019

Choose a reason for hiding this comment

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

The way we're handling exceptions is throwing away information. What about the error code, etc? Probably doesn't belong in this PR, but something to think about.

@besirkurtulmus besirkurtulmus merged commit 1560c6b into master Feb 27, 2019
@besirkurtulmus besirkurtulmus deleted the api-client branch February 27, 2019 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments

Close sidebar
Morty Proxy This is a proxified and sanitized view of the page, visit original site.