Save one of the last spots in our Shell + Git + GitLab introdoctury course on Friday and Monday next week. 👉 Register here.

Commit c83278f9 authored by Pape, David (FWCC) - 139658's avatar Pape, David (FWCC) - 139658
Browse files

Enabling slurmdbd, setting up database.

parent 73ad7ab9
Pipeline #20565 passed with stage
in 10 minutes and 44 seconds
......@@ -5,26 +5,28 @@ RUN dnf install -y \
nano hostname hwloc procps-ng wget which tree dnf-plugins-core rpm-build \
cmake make gcc gcc-c++ gcc-gfortran openmpi pkgconf lcov \
munge munge-devel \
#slurm slurm-slurmctld slurm-slurmd \
mariadb-server mariadb-devel \
libconfig-devel spdlog-devel doxygen graphviz python
# install Slurm with hacky "patch" to enable front end mode
# recompile Slurm rpms enabling multiple-slurmd option
RUN dnf download --source slurm
RUN rpm -i slurm*
RUN rpm -i slurm*.src.rpm
WORKDIR /root/rpmbuild/SPECS
RUN sed -i "s/--enable-shared/--enable-shared --enable-front-end/" slurm.spec
RUN sed -i "s/--disable-multiple-slurmd/--enable-multiple-slurmd/" slurm.spec
RUN dnf builddep -y slurm.spec
RUN rpmbuild -bb slurm.spec
WORKDIR /root/rpmbuild/RPMS/x86_64
RUN dnf install -y slurm*.rpm
RUN dnf install -y slurm{,-libs,-devel,-perlapi,-slurm{ctld,d,dbd}}-$(ls slurm* | head -n 1 | cut -d - -f 2-)
WORKDIR /
RUN rm -rf slurm*.rpm /root/rpmbuild
RUN rm -rf slurm*.src.rpm /root/rpmbuild
RUN useradd --system -c "Slurm Workload Manager" -s /sbin/nologin slurm && \
mkdir -p /var/spool/slurm{,ctl}d && chown slurm /var/spool/slurm{,ctl}d && \
mkdir -p /var/{run,log}/slurm && chown slurm /var/{run,log}/slurm
ADD https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh /usr/local/bin/
RUN chmod 755 /usr/local/bin/wait-for-it.sh
RUN useradd -c "Default user" -G users -m janedoe
RUN useradd --system -c "Slurm Workload Manager" -s /sbin/nologin slurm && \
mkdir -p /var/{spool,run,log}/slurm && chown slurm /var/{spool,run,log}/slurm
RUN useradd -c "Jane Doe" -G users -m janedoe
COPY docker-entrypoint.sh /usr/local/bin/
......
#!/bin/bash
#set -e
_munge_setup() {
create-munge-key -f > /dev/null
sudo -u munge munged
}
# TODO: Create slurm user
_mysql_setup() {
mysql_install_db --user=mysql > /dev/null
mysqld_safe --user=mysql --no-watch > /dev/null
wait-for-it.sh -q localhost:3306
mysql <<EOF
CREATE USER 'slurm'@'localhost';
SET PASSWORD FOR 'slurm'@'localhost' = PASSWORD('password');
GRANT USAGE ON *.* TO 'slurm'@'localhost';
CREATE DATABASE slurm_acct_db;
GRANT ALL ON slurm_acct_db.* TO 'slurm'@'localhost';
FLUSH PRIVILEGES;
EOF
}
_slurmdb_setup() {
cat > /etc/slurm/slurmdbd.conf <<EOF
#
# See the slurmdbd.conf man page for more information.
#
DbdHost=localhost
PidFile=/var/run/slurm/slurmdbd.pid
SlurmUser=slurm
# Archive info
# don't archive
# Authentication info
AuthType=auth/munge
# Database info
StorageType=accounting_storage/mysql
StorageUser=slurm
StoragePass=password
EOF
slurmdbd
wait-for-it.sh -q localhost:6819
}
_slurm_setup() {
cat > /etc/slurm/slurm.conf <<EOF
......@@ -18,18 +56,23 @@ _slurm_setup() {
SlurmUser=slurm
SlurmdUser=slurm
SlurmctldHost=$(hostname -s)(localhost)
SlurmctldHost=localhost
SlurmctldPidFile=/var/run/slurm/slurmctld.pid
SlurmdPidFile=/var/run/slurm/slurmd.pid
SlurmdPidFile=/var/run/slurm/slurmd-%n.pid
SlurmctldPort=6817
SlurmdPort=6818
#SlurmdPort=6801
#SlurmdPort=6802
#SlurmdPort=6803
#SlurmdPort=6804
SlurmdSpoolDir=/var/spool/slurm/slurmd-%n
AuthType=auth/munge # auth_none.so not available on Fedora
AuthType=auth/munge
EnforcePartLimits=NO
MailProg=/bin/true # so the daemons don't complain
MpiDefault=none
ProctrackType=proctrack/pgid # setup with cgroups possible in container?
ProctrackType=proctrack/linuxproc # setup with cgroups possible in container?
ReturnToService=0
StateSaveLocation=/var/spool/slurmctld
StateSaveLocation=/var/spool/slurm/slurmctld
SwitchType=switch/none
TaskPlugin=task/none
......@@ -48,34 +91,46 @@ SelectType=select/linear
# JOB PRIORITY
# TODO: Cleanup needed when setting up slurmdbd.
# LOGGING AND ACCOUNTING
SlurmctldLogFile=/var/log/slurm/slurmctld.log
SlurmdLogFile=/var/log/slurm/slurmd.log
AccountingStorageType=accounting_storage/none
# ACCOUNTING
ClusterName=sid # sid = Slurm in Docker
JobCompType=jobcomp/none
JobAcctGatherFrequency=30
JobAcctGatherType=jobacct_gather/none
AccountingStorageType=accounting_storage/slurmdbd
JobAcctGatherType=jobacct_gather/linux
# LOGGING
SlurmctldLogFile=/var/log/slurm/slurmctld.log
SlurmdLogFile=/var/log/slurm/slurmd-%n.log
SlurmctldDebug=3
SlurmdDebug=3
MailProg=/bin/true # so the daemons don't complain
# COMPUTE NODES
NodeName=sidc[1-4] NodeHostName=localhost
NodeName=sidc[1-4] NodeHostName=localhost Port=[6801-6804]
# PARTITIONS
PartitionName=sidp Nodes=sidc[1-4] Default=YES MaxTime=1:00:00 State=UP
EOF
sudo -u slurm slurmctld
sudo -u slurm slurmd
slurmctld -c
sudo -u slurm slurmd -N sidc1
sudo -u slurm slurmd -N sidc2
sudo -u slurm slurmd -N sidc3
sudo -u slurm slurmd -N sidc4
}
_slurm_accounting() {
{
sacctmgr -i add cluster sid
sacctmgr -i add account test Cluster=sid Description="test account" Organization="none"
sacctmgr -i add user janedoe DefaultAccount=test
} > /dev/null
}
_main() {
_munge_setup
_mysql_setup
_slurmdb_setup
_slurm_setup
_slurm_accounting
if [[ "${1:0:1}" = "-" ]]; then
echo "Please pass a program name to the container!"
......
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