Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions profiles/slurm/submit
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ fi
export DEP_STRING
export SBATCH_ARGS

# need to return just the job ID part to enable snakemake to build dependencies correctly
# $@ should still contain the job execution script generated by snakemake
sbatch ${DEP_STRING} ${SBATCH_ARGS} $@ | cut -f4 -d' '
# Submit the job, retrying if sbatch fails to submit the job.
# It is important to not continue after a failure otherwise the JOBID is reported as an empty string.
JOBID=''
while true
do
# need to return just the job ID part to enable snakemake to build dependencies correctly
# $@ should still contain the job execution script generated by snakemake
JOBID=$(sbatch ${DEP_STRING} ${SBATCH_ARGS} $@ | cut -f4 -d' ')
if [ "$JOBID" != '' ]; then
break
fi
echo "Failed to submit job to slurm, waiting 10 seconds" 1>&2
sleep 10
done
echo -n $JOBID