cgroups inside singularity container

This commit is contained in:
2021-07-02 00:47:32 +02:00
parent 8bc2f717e0
commit f73fef1473
4 changed files with 27 additions and 2 deletions

View File

@@ -8,15 +8,27 @@ function handler_quit(){
echo "shutdown container"
singularity instance stop slurm-drone
scontrol update NodeName=${nodename} State=FUTURE
umount /inner-cgroup/freezer
umount /inner-cgroup
exit 0
}
trap handler_quit EXIT
# set -x
trap handler_quit EXIT
echo "mounting cgroups"
mkdir /inner-cgroup
mount -t tmpfs none /inner-cgroup
mkdir /inner-cgroup/freezer/
mount --bind /sys/fs/cgroup/freezer/slurm/ /inner-cgroup/freezer/
mount -o remount,ro /inner-cgroup
echo "starting ${nodename}"
singularity instance start --writable-tmpfs /shared/slurmd.sif slurm-drone \
singularity instance start \
-B /inner-cgroup/:/sys/fs/cgroup/ \
--writable-tmpfs /shared/slurmd.sif slurm-drone \
slurm-ctl ${nodename}
if [ $? -eq 0 ] ; then
echo "container started, sleeping $(( 60 * ${SLURM_Walltime}))"