-
Notifications
You must be signed in to change notification settings - Fork 0
/
bac_dev.job
102 lines (70 loc) · 3.17 KB
/
bac_dev.job
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
##SBATCH -p r630-hpc3
##SBATCH -w lewis4-r630-hpc3-node548
#SBATCH -p Gpu
#SBATCH -t 0-02:00 # time (days-hours:minutes)
#SBATCH --ntasks-per-node=10
#SBATCH --mem=100G
#SBATCH --output=/home/%u/log_bac_dev.job.%j
##SBATCH [email protected] # email address for notifications
##SBATCH --mail-type=END,FAIL # which type of notifications to send
#SBATCH -J bac_dev
module load singularity
WORK_DIR=$(python -c 'import tempfile; print(tempfile.mkdtemp())')
mkdir -p -m 700 ${WORK_DIR}/run ${WORK_DIR}/tmp ${WORK_DIR}/var/lib/rstudio-server
HOME_R_DIR=${HOME}/R
R_DIR=/storage/hpc/data/${USER}/R
mkdir -p ${R_DIR}
HOME_MYDATA=$HOME/mydata
MYDATA=/storage/hpc/data/${USER}/mydata
mkdir -p ${MYDATA}
SITE_LIB=/storage/hpc/data/sw7v6/site-library
LOCAL_SHARE="/storage/hpc/data/${USER}/local_share"
mkdir -p ${LOCAL_SHARE}
RSTUDIO_SESSION="/storage/hpc/data/${USER}/logs/rstudio_${SLURM_JOB_ID}"
mkdir -p ${RSTUDIO_SESSION}
export SINGULARITYENV_RSTUDIO_SESSION_TIMEOUT=0
export SINGULARITYENV_USER=${USER}
export SINGULARITYENV_PASSWORD=$(openssl rand -base64 20)
readonly PORT=$(python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()')
cat 1>&2 <<END
#*** Credit: Sarayut (Nine) Winuthayanon, https://www.linkedin.com/in/winuthayanons/ ***#
How to Run RStudio Server on the Slurm Cluster:
1. Execute either of the following commands in your local computer terminal:
ssh -N -L ${PORT}:${HOSTNAME}:${PORT} ${SINGULARITYENV_USER}@lewis.rnet.missouri.edu
ssh -N -L ${PORT}:${HOSTNAME}:${PORT} ${SINGULARITYENV_USER}@lewis42.rnet.missouri.edu
ssh -N -L ${PORT}:${HOSTNAME}:${PORT} ${SINGULARITYENV_USER}@lewis4-dtn.rnet.missouri.edu
ssh -N -L ${PORT}:${HOSTNAME}:${PORT} ${SINGULARITYENV_USER}@lewis4-dtn1.rnet.missouri.edu
2. In your browser, visit
http://localhost:${PORT}
3. Log in with these credentials:
User: ${SINGULARITYENV_USER}
Password: ${SINGULARITYENV_PASSWORD}
4. Check job status on login node:
sacct
# To find jobs were issued from May 2023:
sacct -S 2023-05-01
To terminate the job:
1. Exit RStudio (top-right power button)
2. On the login node:
scancel -f ${SLURM_JOB_ID}
END
SIF_FILE=/storage/hpc/group/ircf/software/singularity_bac_dev/bac_dev_20230525.sif
singularity exec -B ${SITE_LIB}:/usr/local/lib/R/site-library \
-B ${LOCAL_SHARE}:${HOME}/.local/share \
-B ${R_LIBS_USER}:${R_LIBS_USER} \
-B ${RSTUDIO_SESSION}:${HOME}/.local/share/rstudio \
-B ${MYDATA}:${HOME_MYDATA} \
-B ${R_DIR}:${HOME_R_DIR} \
-B ${WORK_DIR}/run:/run \
-B ${WORK_DIR}/tmp:/tmp \
-B ${WORK_DIR}/var/lib/rstudio-server:/var/lib/rstudio-server \
--writable-tmpfs \
--cleanenv ${SIF_FILE} \
rserver --www-port=${PORT} \
--auth-none=0 \
--auth-pam-helper-path=pam-helper \
--auth-stay-signed-in-days=30 \
--auth-timeout-minutes=0 \
--server-user=${USER}
printf 'rserver exited' 1>&2