diff --git a/anduril/slurm-cake b/anduril/slurm-cake new file mode 100755 index 0000000..54912a5 --- /dev/null +++ b/anduril/slurm-cake @@ -0,0 +1,27 @@ +#!/bin/bash + +[ -z "$2" ] && { echo 'Usage: $0 "file" "some" "command" + Runs the command when file exists. waits for max 5 minutes' + return +} + +fname="$1" +shift 1 +otime=1 +while : +do [ -e "$fname" ] || { + echo -n "File: $fname not found! " + date + } + [ -e "$fname" ] && { + break + } + otime=$(( $otime + 1 )) + sleep 1 + [ $otime -gt 300 ] && { + echo "File $fname still missing after 5 minutes!" + exit 1 + } +done + +eval "$@" diff --git a/anduril/slurm-maxfree b/anduril/slurm-maxfree index 4ab00e6..6e8edc0 100755 --- a/anduril/slurm-maxfree +++ b/anduril/slurm-maxfree @@ -112,4 +112,4 @@ fi echo "The job file is in $JOBFILE" # send the job -srun --nodelist=${NODELIST[$INDEX]} "$JOBFILE" +srun --nodelist=${NODELIST[$INDEX]} slurm-cake "$JOBFILE" diff --git a/anduril/slurm-random b/anduril/slurm-random index 1d6e7ff..10667a6 100755 --- a/anduril/slurm-random +++ b/anduril/slurm-random @@ -107,6 +107,6 @@ fi echo "The job file is in $JOBFILE" # send the job -srun --nodelist=${NODELIST[$INDEX]} "$JOBFILE" +srun --nodelist=${NODELIST[$INDEX]} slurm-cake "$JOBFILE" wait