slurm container running when drone started

This commit is contained in:
2021-07-01 15:19:35 +02:00
parent d88761ca7d
commit 8bc2f717e0
8 changed files with 114 additions and 4 deletions

View File

@@ -0,0 +1,25 @@
#!/bin/sh
#SBATCH -D /shared
export
echo $@
nodename=$(hostname | awk '{ print "drone" substr($1,match($1, "([[:digit:]]+)")) }')
function handler_quit(){
echo "shutdown container"
singularity instance stop slurm-drone
scontrol update NodeName=${nodename} State=FUTURE
exit 0
}
trap handler_quit EXIT
# set -x
echo "starting ${nodename}"
singularity instance start --writable-tmpfs /shared/slurmd.sif slurm-drone \
slurm-ctl ${nodename}
if [ $? -eq 0 ] ; then
echo "container started, sleeping $(( 60 * ${SLURM_Walltime}))"
sleep $(( 60 * ${SLURM_Walltime} ))
fi
handler_quit