Parsing the jobid for dependencies

To simplify your workflow with job dependencies to construct complex pipelines or chain together long simulations requiring multiple steps, you can use  the --parsable option to sbatch. This command outputs only the job id number. Check the example below:

jobid1=$(sbatch --parsable submit_job1.sh )
jobid2=$(sbatch --parsable --dependency=afterany:$jobid1 submit_job2.sh)
jobid3=$(sbatch --parsable --dependency=afterany:$jobid1 submit_job3.sh)
sbatch --dependency=afterok:$jobid2,afterok:$jobid3 submit_finaljob.sh