...
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/3.6.5
## 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 in above python-notebook.slurm script 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
.
Send job to queue using sbatch
command on login node of Prometheus
...
Code Block |
---|
|
Copy/Paste this in your local terminal to ssh tunnel with remote
-----------------------------------------------------------------
ssh -o ServerAliveInterval=300 -N -L 8511:172.20.68.193:8511 plgusername@pro.cyfronet.pl
-----------------------------------------------------------------
Then open a browser on your local machine to the following address
------------------------------------------------------------------
localhost:8511 (prefix w/ https:// if using password)
------------------------------------------------------------------
## You exec in another shell given command:
> ssh -o ServerAliveInterval=300 -N -L 8511:172.20.68.193:8511 plgusername@pro.cyfronet.pl
## And you are set, you can open in browser:
> `localhost:8511` |
...