forked from giovtorres/slurm-docker-cluster
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-entrypoint.sh_prod
executable file
·85 lines (64 loc) · 2.37 KB
/
docker-entrypoint.sh_prod
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
# ADD DOCUMENTATION HERE TODO
export PATH="/usr/local/nvidia/bin:$PATH"
export PATH="/usr/local/cuda:$PATH"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64
export MYSQL_PASSWORD="$(cat /root/mysql_password.txt)"
set -e
sed -e "s/MYSQL_PASSWORD/$MYSQL_PASSWORD/g" /etc/slurm/slurmdbd.conf > \
/etc/slurm/slurmdbd_temp.conf
mv -f /etc/slurm/slurmdbd_temp.conf /etc/slurm/slurmdbd.conf
chown slurm: /etc/slurm/slurmdbd.conf
chmod 600 /etc/slurm/slurmdbd.conf
if [ "$1" = "slurmdbd" ]
then
echo "---> Starting nslcd ldap client daemon ..."
/usr/sbin/nslcd
echo "---> Starting the MUNGE Authentication service (munged) ..."
gosu munge /usr/sbin/munged
echo "---> Starting the Slurm Database Daemon (slurmdbd) ..."
until echo "SELECT 1" | mysql -h mysql -uslurm -p$MYSQL_PASSWORD 2>&1 > /dev/null
do
echo "-- Waiting for database to become active ..."
sleep 2
done
echo "-- Database is now active ..."
exec gosu slurm /usr/sbin/slurmdbd -Dvvv
fi
if [ "$1" = "slurmctld" ]
then
echo "---> Starting nslcd ldap client daemon ..."
/usr/sbin/nslcd
echo "---> Starting the sshd daemon ..."
/usr/sbin/sshd -p22
echo "---> Starting the MUNGE Authentication service (munged) ..."
gosu munge /usr/sbin/munged
echo "---> Waiting for slurmdbd to become active before starting slurmctld ..."
until 2>/dev/null >/dev/tcp/slurmdbd/6819
do
echo "-- slurmdbd is not available. Sleeping ..."
sleep 2
done
echo "-- slurmdbd is now active ..."
echo "---> Starting the Slurm Controller Daemon (slurmctld) ..."
exec gosu slurm /usr/sbin/slurmctld -Dvvv -i
fi
if [ "$1" = "slurmd" ]
then
echo "---> Starting nslcd ldap client daemon ..."
/usr/sbin/nslcd
echo "---> Starting the MUNGE Authentication service (munged) ..."
gosu munge /usr/sbin/munged
echo "---> Waiting for slurmctld to become active before starting slurmd..."
until 2>/dev/null >/dev/tcp/slurmctld/6817
do
echo "-- slurmctld is not available. Sleeping ..."
sleep 2
done
echo "-- slurmctld is now active ..."
echo "---> Setting up Gres ..."
printf "NAME=gpu Type=P100 File=`find /dev/ -name "nvidia?"` CPUs=0-3\n" > /etc/slurm/gres.conf
echo "---> Starting the Slurm Node Daemon (slurmd) ..."
exec /usr/sbin/slurmd -Dvvv
fi
exec "$@"