StatCan / aaw

Documentation for the Advanced Analytics Workspace Platform
https://statcan.github.io/aaw/
Other
67 stars 12 forks source link

2.0: Auto-start notebook on login #1922

Closed mathis-marcotte closed 5 months ago

mathis-marcotte commented 6 months ago

For 2.0, there will be a default notebook created in a user's namespace. That notebook will need to be auto-started when the user logins to their namespace.

This will need to be done in both centraldashboard for the login trigger, and jupyter-apis for the actual logic of starting a notebook.

mathis-marcotte commented 6 months ago

The api call from jupyter api to start a notebook is a PATCH call to api/namespaces/{namespace}/notebooks/{name} with the body {stopped: true}. So, we just need to send that call to the jupyter api from whatever trigger we want(in this case, after the login) to start the notebook. To know the name of which notebook to start, I see two ways we could find it:

mathis-marcotte commented 6 months ago

As a first draft, I added the api call in with the rest of the other api calls in the main-page.pug of centraldashboard that loads up the environment. This call first gets the list of notebooks for the current namespace. Then, it loops through the notebooks to find the first one with the label notebook.statcan.gc.ca/default-notebook set to true, as well as a status of "stopped". It then sends the request to start the notebook

mathis-marcotte commented 5 months ago

Pr merged