JupyterLab 🔗

  • Below you will find an example job script which you can submit to start a JupyterLab instance on a PALMA compute node

  • After submitting the job and when this job is running, you can establish an SSH tunnel from your local machine to PALMA

  • You can than point your browser to the JupyterLab instance

  • When you are done, stop the job by using scancel <jobid>

  • Please adjust the #SBATCH directives to your needed resources

  • Instructions can be found in the generated Job log file

There are different JupyterLab versions available. To use them, you have to adjust the modules, loaded in the script:

JupyterLab VersionModules to loadAvailable on CPU Architectures
1.2.5ml palma/2019b foss/2019b JupyterLab/1.2.5-Python-3.7.4skylake
2.2.8ml palma/2020b foss/2020b JupyterLab/2.2.8skylake
3.2.8ml palma/2021a foss/2021a JupyterLab/3.2.8skylake, zen2, zen3, zen4
3.5.0ml palma/2022a  foss/2022a JupyterLab/3.5.0skylake, zen2, zen3, zen4
4.0.5ml palma/2023a  foss/2023a JupyterLab/4.0.5skylake, zen2, zen3, zen4
4.2.0ml palma/2023b foss/2023b JupyterLab/4.2.0skylake, zen2, zen3, zen4

Job Script to start JupyterLab 🔗

Use only for JupyterLab >= 4.0.5
#!/bin/bash

#SBATCH --partition=zen4
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=12
#SBATCH --time=12:00:00
#SBATCH --job-name=jupyter-notebook
#SBATCH --output=jupyter-notebook-%j.log
 
echo "------------------------------------------------------------"
echo "SLURM JOB ID: $SLURM_JOBID"
echo "Running on nodes: $SLURM_NODELIST"
echo "------------------------------------------------------------"
 
# Load the JupyterLab module
module load palma/2023a foss/2023a
module load JupyterLab/4.0.5
 
# Load every other python module you might want to use (has to be within the
# toolchain of the JupyterLab module!
module load SciPy-bundle
module load matplotlib
 
# set a random port for the notebook, in case multiple notebooks are
# on the same compute node.
NOTEBOOKPORT=`shuf -i 8000-8500 -n 1`
 
# set a random port for tunneling, in case multiple connections are happening
# on the same login node.
TUNNELPORT=`shuf -i 8501-9000 -n 1`
 
# set a random access token
TOKEN=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 49 | head -n 1`
 
echo "On your local machine, run:"
echo ""
echo "ssh -L8888:localhost:$TUNNELPORT $USER@palma-login.uni-muenster.de -t 'ssh -L$TUNNELPORT:localhost:$NOTEBOOKPORT $SLURMD_NODENAME -N -4'"
echo ""
echo "and point your browser to http://localhost:8888/?token=$TOKEN"
echo "Change '8888' to some other value if this port is already in use on your PC,"
echo "for example, you have more than one remote notebook running."
echo "To stop this notebook, run 'scancel $SLURM_JOB_ID'"
 
# Start the notebook
srun -n1 jupyter lab --no-browser --port=$NOTEBOOKPORT --ServerApp.token=$TOKEN --log-level WARN
# To stop the notebook, use 'scancel'
Use only for JupyterLab < 4.0.5
#!/bin/bash

#SBATCH --partition=normal
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=6
#SBATCH --time=12:00:00
#SBATCH --job-name=jupyter-notebook
#SBATCH --output=jupyter-notebook-%j.log

echo "------------------------------------------------------------"
echo "SLURM JOB ID: $SLURM_JOBID"
echo "Running on nodes: $SLURM_NODELIST"
echo "------------------------------------------------------------"

# Load the JupyterLab module
module load palma/2021a
module load foss/2021a
module load JupyterLab/3.2.8

# Load every other python module you might want to use (has to be within the
# toolchain of the JupyterLab module!
module load SciPy-bundle
module load matplotlib

# set a random port for the notebook, in case multiple notebooks are
# on the same compute node.
NOTEBOOKPORT=`shuf -i 8000-8500 -n 1`

# set a random port for tunneling, in case multiple connections are happening
# on the same login node.
TUNNELPORT=`shuf -i 8501-9000 -n 1`

# set a random access token
TOKEN=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 49 | head -n 1`

echo "On your local machine, run:"
echo ""
echo "ssh -L8888:localhost:$TUNNELPORT $USER@palma-login.uni-muenster.de -t 'ssh -L$TUNNELPORT:localhost:$NOTEBOOKPORT $SLURMD_NODENAME -N -4'"
echo ""
echo "and point your browser to http://localhost:8888/?token=$TOKEN"
echo "Change '8888' to some other value if this port is already in use on your PC,"
echo "for example, you have more than one remote notebook running."
echo "To stop this notebook, run 'scancel $SLURM_JOB_ID'"

# Start the notebook
srun -n1 jupyter-notebook --no-browser --port=$NOTEBOOKPORT --NotebookApp.token=$TOKEN --log-level WARN
# To stop the notebook, use 'scancel'