Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Remote Spawn Profile
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RWTHjupyter
Remote Spawn Profile
Commits
e9d5749d
Commit
e9d5749d
authored
4 years ago
by
Steffen Vogel
Browse files
Options
Downloads
Patches
Plain Diff
remove obsolete script
parent
7f8fa93b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
image/spawn.sh
+0
-82
0 additions, 82 deletions
image/spawn.sh
with
0 additions
and
82 deletions
image/spawn.sh
deleted
100644 → 0
+
0
−
82
View file @
7f8fa93b
#!/bin/bash
CLUSTER_LOGIN_NODE
=
login18-1.hpc.itc.rwth-aachen.de
DIR
=
~/.jupyter-rwth-hpc
if
[
-f
"
${
DIR
}
/settings.sh"
]
;
then
.
${
DIR
}
/settings.sh
fi
# Run on cluster
CRUN
=
"ssh -l
${
CLUSTER_USER
}
${
CLUSTER_LOGIN_NODE
}
--"
# Unique ID for this Jupyter spawn.
# Required for supporting multiple Jupyter jobs in SLURM
SPAWN_ID
=
$(
cat
/dev/urandom |
tr
-dc
'a-zA-Z0-9'
|
fold
-w
8 |
head
-n
1
)
# set a random port for the notebook, in case multiple notebooks are
# on the same compute node.
PORT
=
$(
shuf
-i
8000-8500
-n
1
)
function
finish
{
# Close tunnel
if
[
-n
"
${
SSH_PID
}
"
]
;
then
kill
${
SSH_PID
}
fi
# Cancel job
if
[
-n
$$
{
JOB_ID
}
]
;
then
${
CRUN
}
scancel
${
JOB_ID
}
fi
}
trap
finish EXIT
# Queue job
${
CRUN
}
/bin/bash sbatch
<<
EOF
#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --mem-per-cpu=8G
#SBATCH --time=1-0:00:00
#SBATCH --job-name=jupyter-
${
SPAWN_ID
}
#SBATCH --output=jupyter-notebook-%J.log
#SBATCH --partition=c16m
module switch intel gcc
module load python/3.6.0
python3 -m pip install --user --upgrade pip
python3 -m pip install --user --upgrade jupyterhub jupyterlab
srun -n1
\$
(python3.6 -m site --user-base)/bin/jupyterhub-singleuser --no-browser --ip=0.0.0.0 --port=
${
PORT
}
EOF
# Wait until job is scheduled
JOB_STATE
=
"UNKNOWN"
while
[
"
${
JOB_STATE
}
"
!=
"RUNNING"
]
;
do
# Check job status
JOB_STATUS
=
$(
${
CRUN
}
squeue
-u
${
CLUSTER_USER
}
-h
-o
\"
%.i %j %T %N %R
\"
|
grep
${
SPAWN_ID
}
)
if
[
-z
"
${
JOB_STATUS
}
"
]
;
then
break
;
fi
read
-r
JOB_ID JOB_NAME JOB_STATE JOB_NODE JOB_REASON
<<<
${
JOB_STATUS
}
echo
"Waiting for job
${
JOB_ID
}
(
${
JOB_NAME
}
) on node
${
JOB_NODE
}
to run. Current state:
${
JOB_STATE
}
(
${
JOB_REASON
}
)"
sleep
1
done
# Setup tunnel
ssh
-L
"[::]:8888:
${
JOB_NODE
}
:
${
PORT
}
"
-l
${
CLUSTER_USER
}
${
CLUSTER_LOGIN_NODE
}
-N
&
SSH_PID
=
$!
echo
"Jupyter started.."
echo
echo
" Access at: http://localhost:8888"
echo
"Sleeping. Waiting for termination"
while
true
;
do
sleep
inf &
wait
$!
echo
"Sleep over.."
# shouldnt happen?
done
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment