Sitelet https://github.com/OpenSourceBrain/OSBv2/pull/1023
Skip to content

Feature/IDP-Run-workspace - Run notebooks in a workspace - #1023

Open
D-GopalKrishna wants to merge 19 commits into
developfrom
feature/IDP-43
Open

D-GopalKrishna wants to merge 19 commits into
developfrom
feature/IDP-43

Conversation

@D-GopalKrishna

@D-GopalKrishna D-GopalKrishna commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Task description:

  • A new endpoint, POST /workspace/{id}/run, that runs a list of notebooks from a folder already on the workspace volume (typically a protocol's analysis code, imported from GitHub as a zip), using papermill in an Argo task.
  • Cleans up env vars - since the role of this argo flow is to run custom notebooks - and any env from OSB should be cleaned first. RunNotebooksTask leaves the Keycloak secret and allvalues mounts out of the run pod, and run.sh runs the code without the CH_* variables (env -i).

and

  • Run task (run.sh): copies the repository to scratch (repo.discard removes the original), installs setup, then runs each notebook in order with papermill, passing INPUT_DIR / OUTPUT_DIR; the first failure stops the run.
  • Outcome in the folder name: executed notebooks go to <results.notebooks>.running, renamed on exit to <results.notebooks> if all passed or <results.notebooks>.failed if not; the workflow's exit-handler scan then lists them, so a client tells success from failure by which folder GET /workspace/{id} resources shows.

@D-GopalKrishna
D-GopalKrishna marked this pull request as draft September 16, 2026 08:26
@D-GopalKrishna

D-GopalKrishna commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

One of the issues I'm seeing: JupyterHub's pod-spawn code (osb_jupyterhub.py) mounts a jupyter_notebook_config.py file from a ConfigMap into every singleuser pod, but it seems like it was deleted in develop branch at some point — leaving the ConfigMap empty.
I am investigating why this only happens for me and not in develop branch. Perhaps i am missing something locally.

Only for the jupyterlab-minimal image - otherwise checked jupyterlab works perfectly fine.

@D-GopalKrishna D-GopalKrishna changed the title Feature/idp 43 - Analyse and explore the amber dandi documentation to allow the data storage from IDP in Ember Feature/IDP-Run-workspace - Run notebooks in a workspace Oct 5, 2026
@D-GopalKrishna
D-GopalKrishna marked this pull request as ready for review October 5, 2026 19:04

@filippomc filippomc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In order to make the feature sustainable, have to respect quotas, and have to think a bit how to configure the runtime


RUN_NOTEBOOKS_BASENAME = "osb-run-notebooks-job"
# CustomTask sets no limits by default; the notebooks are third-party code.
RUN_NOTEBOOKS_RESOURCES = {"requests": {"cpu": "100m", "memory": "256Mi"}, "limits": {"cpu": "1", "memory": "2Gi"}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

resources must be taken from the user quotas

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

using get_run_resources to get the requests an limits now.

ADD run.sh /run.sh

RUN chmod +x /run.sh
CMD ["/run.sh"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In order to run notebooks, have to make sure that all the libraries needed are in the env. Unless we make sure that notebooks all have the requirements installed first inside the notebook itself. One alternative can be to use the jupyterlab image, so everything can run there, can run here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps an even more flexible and scalable option, the request specifies the image where to run

@D-GopalKrishna D-GopalKrishna Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We do the installation as part of run.sh - by expecting a standard requirements.txt and install path for setup.py|pyproject.toml. This will allow us to run in the argo pod, but agreed for them to run this - notebooks have to declare the requirements installation as part of it.

Using the JupyterLab image now, and passing which script to run from the request param - This is now in the Configmap - and picked based on where the request asks to run.

@filippomc filippomc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd like to improve the code clarity a little, and the parametrization strategy

Comment thread applications/workspaces/deploy/resources/run-notebooks/README.md Outdated
Comment thread applications/workspaces/server/workspaces/controllers/workspace_run_controller.py Outdated
Comment thread applications/workspaces/server/workspaces/controllers/workspace_run_controller.py Outdated
Comment thread applications/workspaces/deploy/values.yaml Outdated
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.

2 participants