Commit 0f70aaa3 authored by Adam Fekete's avatar Adam Fekete
Browse files

running slurm as non-root user

parent 797baf35
......@@ -82,5 +82,26 @@ COPY --chown=$NB_UID:$NB_GID pseudo_dojo /opt/pseudo_dojo
WORKDIR /opt/pseudo_dojo
RUN pip install -e .
# Setup slurm
# ===========
USER root
RUN apt-get update \
&& apt install -y --no-install-recommends \
slurmd slurm-client slurmctld \
&& rm -rf /var/lib/apt/lists/*
COPY configs/slurm.conf /etc/slurm-llnl/slurm.conf
COPY configs/start_slurm.sh /usr/local/bin/before-notebook.d/
# https://github.com/yuwata/slurm-fedora/blob/master/slurm-setuser.in
RUN mkdir -p /run/munge \
&& chown -R jovyan /run/munge /etc/munge /var/lib/munge /var/log/munge \
&& mkdir -p /var/run/slurm-llnl \
&& chown -R jovyan /var/run/slurm-llnl /var/lib/slurm-llnl /var/log/slurm-llnl
USER $NB_UID
WORKDIR $HOME
COPY --chown=$NB_UID:$NB_GID tutorials tutorials
\ No newline at end of file
COPY --chown=$NB_UID:$NB_GID tutorials tutorials
# slurm.conf file generated by configurator easy.html.
# Put this file on all nodes of your cluster.
# See the slurm.conf man page for more information.
ControlMachine=localhost
ControlAddr=127.0.0.1
# MailProg=/bin/mail
MpiDefault=none
# MpiParams=ports=#-#
ProctrackType=proctrack/pgid
ReturnToService=1
SlurmctldPidFile=/var/run/slurm-llnl/slurmctld.pid
# SlurmctldPort=6817
SlurmdPidFile=/var/run/slurm-llnl/slurmd.pid
# SlurmdPort=6818
SlurmdSpoolDir=/var/lib/slurm-llnl/slurmd
SlurmUser=jovyan
SlurmdUser=jovyan
StateSaveLocation=/var/lib/slurm-llnl/slurmctld
SwitchType=switch/none
TaskPlugin=task/none
# TIMERS
# KillWait=30
# MinJobAge=300
# SlurmctldTimeout=120
# SlurmdTimeout=300
# SCHEDULING
FastSchedule=1
SchedulerType=sched/backfill
# SchedulerPort=7321
SelectType=select/linear
# LOGGING AND ACCOUNTING
AccountingStorageType=accounting_storage/none
ClusterName=cluster
# JobAcctGatherFrequency=30
JobAcctGatherType=jobacct_gather/none
# SlurmctldDebug=3
SlurmctldLogFile=/var/log/slurm-llnl/slurmctld.log
# SlurmdDebug=3
SlurmdLogFile=/var/log/slurm-llnl/slurmd.log
# COMPUTE NODES
NodeName=localhost CPUs=1 State=UNKNOWN
PartitionName=debug Nodes=localhost Default=YES MaxTime=INFINITE State=UP
#!/bin/bash
# Handle special flags if we're root
if [ $(id -u) == 0 ]; then
su jovyan /etc/init.d/munge start
su jovyan /etc/init.d/slurmd start
su jovyan /etc/init.d/slurmctld start
else
/etc/init.d/munge start
/etc/init.d/slurmd start
/etc/init.d/slurmctld start
fi
\ No newline at end of file
#!/bin/bash
#SBATCH --partition=debug
sleep 10
echo "done"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment