StatCan / aaw

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

2.0: Create new default Notebook function #1921

Closed mathis-marcotte closed 6 months ago

mathis-marcotte commented 6 months ago

links to https://github.com/StatCan/aaw/issues/1918

We need a function/endpoint for creating a new default notebook that bypasses the new notebook form. This will eventually be called by the central dashboard when a new user creates a new namespace. They will need this new notebook to be created.

So we can just use the default values for inputs that we currently set in the form for this new notebook, with possible inputs for the function being notebook_name, namespace and image(this one I'm not as sure, the jupyter image should fill the needs for basic default users.)

mathis-marcotte commented 6 months ago

The main problem for this issue is that some of the logic to create new notebooks lives in the frontend code. For this endpoint that we want to create to automatically create new notebooks, we want it to live solely in the backend so that it can be easily accessible by central-dashboard without going through a frontend web page. So I could duplicate some code for notebook creation into the backend, but that would be less preferable so that we can try to avoid issues in case of this duplicated logic getting changed only in one place. So another option is to possibly move some of the notebook creation logic to the backend, which would help centralizing this operation if we want it done in two different places.

mathis-marcotte commented 6 months ago

Added the endpoint to our jupyter-apis backend. To create a new default notebook from centraldashboard, we just need to make a post call to kubeflow.aaw-dev.cloud.statcan.ca/_/(jupyter | en | fr)/api/namespaces/{namespace}/notebooks/default (for dev). This will make a new notebook using the default values from the spawner_ui file that we have for most of the values. This will create a new english jupyter notebook with our default settings for cpu and memory. This new notebook will have the name {namespace}-notebook.

image