diff --git a/form.yml b/form.yml index 3aaf67b..08c5cf3 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: 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 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)"