-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-jupyter.bsh
37 lines (30 loc) · 1.45 KB
/
run-jupyter.bsh
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
#!/bin/bash
# Load variables with input settings
source var
# Start SSH agent and add key to connect to SLURM system
eval `ssh-agent -s`
ssh-add ${SLURM_SSH_KEY}
# Define address where to contact the scheduler
HOST_PUBLIC=`curl ifconfig.me`
# Export the socket location to the container (also, need to bind /tmp)
# this will be needed to submit jobs to the SLURM system and to local forward worker's ports
export SSH_AUTH_SOCK
# Export username and host for SLURM system
export SLURM_USER
export SLURM_HOST
# Dask settings
export DASK_CONFIG="${PWD}/config/dask"
export DASK_JOBQUEUE__SLURM__SCHEDULER_OPTIONS__PORT="8786" # port should be open for the workers to reach the scheduler
export DASK_JOBQUEUE__SLURM__SCHEDULER_OPTIONS__CONTACT_ADDRESS="tcp://${HOST_PUBLIC}:${DASK_JOBQUEUE__SLURM__SCHEDULER_OPTIONS__PORT}"
export DASK_JOBQUEUE__SLURM__SCHEDULER_OPTIONS__PRELOAD="${DASK_CONFIG}/scheduler-setup.py"
export DASK_JOBQUEUE__SLURM__PYTHON="apptainer exec ${APPTAINER_IMAGE} python"
# Enable aliases for SLURM commands
export APPTAINERENV_PREPEND_PATH="${PWD}/bin"
# FSSPEC settings for dcache
export FSSPEC_DCACHE_API_URL="https://dcacheview.grid.surfsara.nl:22880/api/v1"
export FSSPEC_DCACHE_WEBDAV_URL="https://webdav.grid.surfsara.nl:2880"
export FSSPEC_DCACHE_TOKEN=${DCACHE_TOKEN}
# Bind /tmp to access SSH agent socket
apptainer -d exec -B /tmp:/tmp ${APPTAINER_IMAGE} jupyter lab --no-browser --port=8888 --ip=0.0.0.0
# kill the SSH agent
kill ${SSH_AGENT_PID}