From 5ec6025e423e515c83ad3036009d3fe859d7c7c6 Mon Sep 17 00:00:00 2001 From: Eric Le Lay Date: Tue, 30 Jun 2026 18:06:21 +0200 Subject: [PATCH 1/2] Add extra_modules_script parameter, like RStudio app It is simply the path to a shell file that will be sourced in the launch script --- form.yml | 8 ++++++++ template/script.sh.erb | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/form.yml b/form.yml index 3aaf67b..10eb726 100644 --- a/form.yml +++ b/form.yml @@ -27,6 +27,13 @@ attributes: # modules: "python/3.5 cuda/8.0.44" modules: "python" + extra_modules_script: + label: Extra modules script + help: If you'd like to load additional modules alongside jupyterhub, put the 'module load ...' commands into a text file (one 'module load...' per line) and specify its path here + widget: text_field + required: false + + # Any extra command line arguments to feed to the `jupyter notebook ...` # command that launches the Jupyter notebook within the batch job extra_jupyter_args: "" @@ -42,6 +49,7 @@ attributes: # Dashboard form: - modules + - extra_modules_script - extra_jupyter_args - bc_account - bc_queue diff --git a/template/script.sh.erb b/template/script.sh.erb index 718951c..87e9c78 100755 --- a/template/script.sh.erb +++ b/template/script.sh.erb @@ -21,6 +21,12 @@ module load <%= context.modules %> module list <%- end -%> +<%- unless context.extra_modules_script.blank? -%> +if [[ -f <%= context.extra_modules_script %> ]]; then + source <%= context.extra_modules_script %> +fi +<%- end -%> + # Benchmark info echo "TIMING - Starting jupyter at: $(date)" From 0300dfa2b262b7214c7cc046a56078c6102669c7 Mon Sep 17 00:00:00 2001 From: Eric Le Lay Date: Fri, 4 Sep 2026 17:57:08 +0200 Subject: [PATCH 2/2] Use path_selector widget and let it show on the session card So users can relaunch the right configuration --- form.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/form.yml b/form.yml index 10eb726..08c5cf3 100644 --- a/form.yml +++ b/form.yml @@ -30,9 +30,9 @@ attributes: extra_modules_script: label: Extra modules script help: If you'd like to load additional modules alongside jupyterhub, put the 'module load ...' commands into a text file (one 'module load...' per line) and specify its path here - widget: text_field + widget: path_selector required: false - + display: true # Any extra command line arguments to feed to the `jupyter notebook ...` # command that launches the Jupyter notebook within the batch job