-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathjupyter.slurm
38 lines (27 loc) · 1.17 KB
/
jupyter.slurm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
#SBATCH --signal=USR2
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=50
#SBATCH --mem=300G
#SBATCH --time=1080:00:00
#SBATCH --output=/home/%u/tmp/errout/jrocker/jupyter.job.%j
# customize --output path as appropriate (to a directory readable only by the user!)
source ~/tools/anaconda3/bin/activate
USER=$(id -un)
PASSWORD=$(openssl rand -base64 15)
readonly PORT=$(python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()')
# PORT=22222
cat 1>&2 <<END
1. SSH tunnel from your workstation using the following command:
ssh -N -L ${PORT}:${HOSTNAME}:${PORT} ${USER}@hpc
and point your web browser to http://${HOSTNAME}:${PORT}/lab
2. log in to Jupyter Server using the following credentials:
user: ${USER}
password: ${PASSWORD}
When done using RStudio Server, terminate the job by:
1. Exit the Jupyter Session ("power" button in the top right corner of the RStudio window)
2. Issue the following command on the login node:
jupyter lab --ip 0.0.0.0 --port ${PORT} --no-browser --notebook-dir=/home/liuc9
scancel -f ${SLURM_JOB_ID}
END
jupyter lab --ip 0.0.0.0 --port ${PORT} --no-browser --notebook-dir=/home/liuc9