Skip to content

Commit

Permalink
Update slurmdbd conf at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-z committed Mar 13, 2024
1 parent 255c1fd commit 582315a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
14 changes: 7 additions & 7 deletions slurmctld/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ stdout_logfile_maxbytes=0
redirect_stderr=true
priority=100

[program:slurmctld]
command=/opt/prefix-output.sh /opt/slurm/sbin/slurmctld -D %(ENV_SLURMCTLD_ARGS)s
[program:runtime_agent]
command=/opt/prefix-output.sh /opt/runtime-agent.sh
autostart=true
autorestart=true
user=slurm
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
priority=150
priority=100

[program:runtime_agent]
command=/opt/prefix-output.sh /opt/runtime-agent.sh
[program:slurmctld]
command=/opt/prefix-output.sh /opt/slurm/sbin/slurmctld -D %(ENV_SLURMCTLD_ARGS)s
autostart=true
autorestart=true
user=slurm
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
priority=200
priority=150
9 changes: 7 additions & 2 deletions slurmdbd/runtime-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@ function watch_runtime_config() {
done
}

function update_slurmdbd_conf() {
cp /etc/slurmdbd_config/slurmdbd.conf /etc/slurm/slurmdbd.conf
chown slurm: /etc/slurm/slurmdbd.conf
}

function watch_slurmdbd_config() {
inotifywait --monitor --recursive --event create,delete,modify,attrib,move /etc/slurmdbd_config | while read FILE; do
echo "Detected changes in /etc/slurmdbd_config/. Updating /etc/slurm/slurmdbd.conf after a short delay."
# approximate debounce
timeout 3 cat > /dev/null || true

echo "Updating /etc/slurm/slurmdbd.conf"
cp /etc/slurmdbd_config/slurmdbd.conf /etc/slurm/slurmdbd.conf
chown slurm: /etc/slurm/slurmdbd.conf
update_slurmdbd_conf

echo "Restarting slurmdbd"
/usr/bin/supervisorctl restart slurmdbd
Expand All @@ -34,6 +38,7 @@ function watch_slurmdbd_config() {

# Inital update
update_passwd_group
update_slurmdbd_conf

# Continuously watch for changes
watch_runtime_config &
Expand Down
14 changes: 7 additions & 7 deletions slurmdbd/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ stdout_logfile_maxbytes=0
redirect_stderr=true
priority=100

[program:slurmdbd]
command=/opt/prefix-output.sh /opt/slurm/sbin/slurmdbd -D %(ENV_SLURMDBD_ARGS)s
[program:runtime_agent]
command=/opt/prefix-output.sh /opt/runtime-agent.sh
autostart=true
autorestart=true
user=slurm
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
priority=150
priority=100

[program:runtime_agent]
command=/opt/prefix-output.sh /opt/runtime-agent.sh
[program:slurmdbd]
command=/opt/prefix-output.sh /opt/slurm/sbin/slurmdbd -D %(ENV_SLURMDBD_ARGS)s
autostart=true
autorestart=true
user=slurm
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
priority=200
priority=150

0 comments on commit 582315a

Please sign in to comment.