...
Code Block |
---|
language | bash |
---|
title | pyton-notebook.slurm |
---|
|
#!/bin/bash
#SBATCH --partition plgrid-testing
#SBATCH --nodes 1
#SBATCH --ntasks-per-node 6
#SBATCH --time 0:30:00
#SBATCH --job-name jupyter-notebook-tunnel
#SBATCH --output jupyter-log-%J.txt
## get tunneling info
XDG_RUNTIME_DIR=""
ipnport=$(shuf -i8000-9999 -n1)
ipnip=$(hostname -i)
user=$USER
## print tunneling instructions to jupyter-log-{jobid}.txt
echo -e "
Copy/Paste this in your local terminal to ssh tunnel with remote
-----------------------------------------------------------------
ssh -o ServerAliveInterval=300 -N -L $ipnport:$ipnip:$ipnport ${user}@pro.cyfronet.pl
-----------------------------------------------------------------
Then open a browser on your local machine to the following address
------------------------------------------------------------------
localhost:$ipnport (prefix w/ https:// if using password)
------------------------------------------------------------------
"
module load plgrid/tools/python
## start an ipcluster instance and launch jupyter server
jupyter-notebook --no-browser --port=$ipnport --ip=$ipnip
|
Info |
---|
|
In case you want to start JupyterLab just change last line from Code Block |
---|
language | bash |
---|
title | Jupyter Notebook |
---|
| jupyter-notebook --no-browser --port=$ipnport --ip=$ipnip |
to Code Block |
---|
language | bash |
---|
title | JupyterLab |
---|
| jupyterlab --no-browser --port=$ipnport --ip=$ipnip |
|
Save it as pyton-notebook.slurm.
...