#!/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