slurm-cake to verify job file exists

This commit is contained in:
ville rantanen
2014-09-12 13:10:30 +03:00
parent 9ab1691c0a
commit 1765580edf
3 changed files with 29 additions and 2 deletions

27
anduril/slurm-cake Executable file
View File

@@ -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 "$@"

View File

@@ -112,4 +112,4 @@ fi
echo "The job file is in $JOBFILE" echo "The job file is in $JOBFILE"
# send the job # send the job
srun --nodelist=${NODELIST[$INDEX]} "$JOBFILE" srun --nodelist=${NODELIST[$INDEX]} slurm-cake "$JOBFILE"

View File

@@ -107,6 +107,6 @@ fi
echo "The job file is in $JOBFILE" echo "The job file is in $JOBFILE"
# send the job # send the job
srun --nodelist=${NODELIST[$INDEX]} "$JOBFILE" srun --nodelist=${NODELIST[$INDEX]} slurm-cake "$JOBFILE"
wait wait