Commit c758fd67 authored by sfux's avatar sfux
Browse files

Merge branch 'new-options' into 'master'

New options

See merge request sfux/Jupyter-on-Euler-or-Leonhard-Open!8
parents e3a117bf 6ec2b0a0
......@@ -107,6 +107,12 @@ JNB_JKERNEL="FALSE"
# Extra cluster modules : no additional modules
JNB_EXTRA_MODULES=()
# Use module collection : no additional collection
JNB_MODULE_USE=""
# Set the remote python path : Leave untouched
JNB_PYTHONPATH=""
###############################################################################
# Usage instructions #
###############################################################################
......@@ -137,6 +143,8 @@ Optional arguments:
-v | --version Display version of the script and exit
-w | --workdir WORKING_DIR Working directory for the jupyter notebook/lab
--extra-modules EXTRA_MODULES Load additional cluster modules before starting
--module-use MODULE_USE Use additional cluster module collection before starting
--pythonpath PYTHONPATH Set PYTHONPATH before starting
-W | --runtime RUN_TIME Run time limit for jupyter notebook/lab in hours and minutes HH:MM
Examples:
......@@ -251,6 +259,16 @@ do
shift
shift
;;
--module-use)
JNB_MODULE_USE="$2"
shift
shift
;;
--pythonpath)
JNB_PYTHONPATH="$2"
shift
shift
;;
*)
echo -e "Warning: ignoring unknown option $1 \n"
shift
......@@ -453,6 +471,7 @@ ENDSSH
echo -e "Connecting to $JNB_HOSTNAME to start jupyter $JNB_START_OPTION in a batch job"
# FIXME: save jobid in a variable, that the script can kill the batch job at the end
ssh $JNB_SSH_OPT bsub -n $JNB_NUM_CPU -W $JNB_RUN_TIME -R "rusage[mem=$JNB_MEM_PER_CPU_CORE]" $JNB_SNUM_GPU <<ENDBSUB
[ -n "$JNB_MODULE_USE" ] && module use "$JNB_MODULE_USE"
module load $JNB_MODULE_COMMAND
if [ "$JNB_ENV" != "" ]; then echo -e "Activating the $JNB_ENV"; source $JNB_ENV/bin/activate; fi
export XDG_RUNTIME_DIR=
......@@ -460,6 +479,7 @@ JNB_IP_REMOTE="\$(hostname -i)"
echo "Remote IP:\$JNB_IP_REMOTE" >> \$HOME/jnbip
export JNB_RUN_TIME=$JNB_RUN_TIME
export JNB_START_TIME=`date +"%Y-%m-%dT%H:%M:%S%z"`
[ -n "$JNB_PYTHONPATH" ] && export PYTHONPATH="\$PYTHONPATH:$JNB_PYTHONPATH"
jupyter $JNB_START_OPTION --no-browser --ip "\$JNB_IP_REMOTE" $JNB_SWORK_DIR &> \$HOME/jnbinfo
ENDBSUB
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment