Skip to content

Conversation

@william-lukusa
Copy link
Contributor

Story details : [ch56395]

@william-lukusa william-lukusa added this to the 9.0 milestone Feb 5, 2021
@william-lukusa william-lukusa self-assigned this Feb 5, 2021
@shortcut-integration
Copy link

This pull request has been linked to Clubhouse Story #56395: Public API to list / get Jupyter notebooks.

"""
if self.state is None:
self.state = self.client._perform_json("GET", "/projects/%s/notebooks/" % self.project_key, params={'notebookName' : self.notebook_name})
notebook_list = self.client._perform_json("GET",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep the cache mechanism?
(If you put back the cache, maybe you should add with an optional parameter clear_cache = false for when the user know the cache is wrong. Or a clear_cache() method)

"""
if self.state is None:
self.state = self.client._perform_json("GET", "/projects/%s/notebooks/" % self.project_key, params={'notebookName' : self.notebook_name})
notebook_list = self.client._perform_json("GET",
Copy link
Contributor

Choose a reason for hiding this comment

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

This variable contains the metadata of the notebook, not a notebook.
The java object is names JupyterNotebookListItem which is super confusing so maybe let's not use that.
Maybe something like:

Suggested change
notebook_list = self.client._perform_json("GET",
notebook_states = self.client._perform_json("GET",


def get_state(self):
"""
Get the status of the notebook
Copy link
Contributor

Choose a reason for hiding this comment

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

This is (and was) not compatible with SQL notebooks

Suggested change
Get the status of the notebook
Get the status of the Jupyter notebook

@william-lukusa
Copy link
Contributor Author

william-lukusa commented Feb 8, 2021

⬆️ I created a new PR based on the suggested changes to add an endpoint for sessions and return the object on create/update

* Use new sessions endpoint in get_sessions call
* Put back cache for state with a refresh parameter to get the state directly from backend
* Return created notebook as object
Copy link
Contributor

@pbailly pbailly left a comment

Choose a reason for hiding this comment

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

LGTM

@william-lukusa william-lukusa merged commit f058695 into master Feb 15, 2021
@pbailly pbailly deleted the feature/dss90-jupyter-notebooks-public-api branch February 16, 2021 09:22
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.

5 participants