Skip to content

Commit

Permalink
Merge pull request #329 from nebius/print_command
Browse files Browse the repository at this point in the history
Print actual command before executing it in bash scripts
  • Loading branch information
asteny authored Jan 17, 2025
2 parents a400c97 + 256cd9c commit 6a6b939
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions images/accounting/slurmdbd_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

set -e # Exit immediately if any command returns a non-zero error code
set -x # Print actual command before executing it

echo "Bind-mount REST JWT key from K8S secret"
touch /var/spool/slurmdbd/jwt_hs256.key
Expand Down
1 change: 1 addition & 0 deletions images/common/scripts/install_docker.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

set -e # Exit immediately if any command returns a non-zero error code
set -x # Print actual command before executing it

# Add Docker's official GPG key
apt update -y
Expand Down
1 change: 1 addition & 0 deletions images/common/scripts/install_docker_cli.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

set -e # Exit immediately if any command returns a non-zero error code
set -x # Print actual command before executing it

# Add Docker's official GPG key
apt update -y
Expand Down
1 change: 1 addition & 0 deletions images/controller/slurmctld_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

set -e # Exit immediately if any command returns a non-zero error code
set -x # Print actual command before executing it

echo "Link users from jail"
ln -s /mnt/jail/etc/passwd /etc/passwd
Expand Down
1 change: 1 addition & 0 deletions images/jail/scripts/createuser.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

set -e
set -x # Print actual command before executing it

if [[ $# -eq 0 ]] || [[ "$*" == *"-h"* ]] || [[ "$*" == *"--help"* ]]; then
echo "Usage: createuser <username> [--with-password] [--without-sudo] [--without-docker] [<args for adduser...>]"
Expand Down
1 change: 1 addition & 0 deletions images/login/sshd_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

set -e # Exit immediately if any command returns a non-zero error code
set -x # Print actual command before executing it

echo "Link users from jail"
ln -s /mnt/jail/etc/passwd /etc/passwd
Expand Down
1 change: 1 addition & 0 deletions images/munge/munge_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

set -e # Exit immediately if any command returns a non-zero error code
set -x # Print actual command before executing it

echo "Link users from jail"
ln -s /mnt/jail/etc/passwd /etc/passwd
Expand Down
1 change: 1 addition & 0 deletions images/nccl_benchmark/nccl_benchmark_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

set -e # Exit immediately if any command returns a non-zero error code
set -x # Print actual command before executing it

echo "Link users from jail"
ln -s /mnt/jail/etc/passwd /etc/passwd
Expand Down
1 change: 1 addition & 0 deletions images/nccl_benchmark/scripts/srun_perf.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

set -e
set -x # Print actual command before executing it

while getopts ":b:e:f:g:t:l:d:u:h:p:n:s:m:w:c:q:" opt; do
case ${opt} in
Expand Down
1 change: 1 addition & 0 deletions images/restd/slurmrestd_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

set -e # Exit immediately if any command returns a non-zero error code
set -x # Print actual command before executing it

echo "Bind-mount slurm configs from K8S config map"
for file in /mnt/slurm-configs/*; do
Expand Down
1 change: 1 addition & 0 deletions images/worker/scripts/gpu_healthcheck.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

set -e
set -x # Print actual command before executing it

# Run GPU healthcheck
output=$(/usr/bin/nvidia-smi 2>&1)
Expand Down
1 change: 1 addition & 0 deletions images/worker/slurmd_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

set -e # Exit immediately if any command returns a non-zero error code
set -x # Print actual command before executing it

echo "Evaluate variables in the Slurm node 'Extra' field"
evaluated_extra=$(eval echo "$SLURM_NODE_EXTRA")
Expand Down
3 changes: 2 additions & 1 deletion images/worker/supervisord_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/bin/bash

set -e # Exit immediately if any command returns a non-zero error code
set -x # Print actual command before executing it

echo "Starting slurmd entrypoint script"
if [ -n "${CGROUP_V2}" ]; then
CGROUP_PATH=$(cat /proc/self/cgroup | sed 's/^0:://')

if [ -n "${CGROUP_PATH}" ]; then
echo "cgroup v2 detected, creating cgroup for ${CGROUP_PATH}"
mkdir -p /sys/fs/cgroup/${CGROUP_PATH}/../system.slice
mkdir -p /sys/fs/cgroup/"${CGROUP_PATH}"/../system.slice
# TODO: uncomment this line when 24.11 will be tested. It is OOMKillStep for taskPluginParam
# echo "1" > /sys/fs/cgroup/${CGROUP_PATH}/../system.slice/memory.oom.group
else
Expand Down

0 comments on commit 6a6b939

Please sign in to comment.