...
Codeblock | ||
---|---|---|
| ||
# submit first job, extract job id sbatch_output=$(sbatch job1.sbatch) jobid=${sbatch_output##* } # submit second job with dependency: starts only if previous job terminates successfully) sbatch_output=$(sbatch --dependency=afterok:$jobid job2.sbatch) jobid=${sbatch_output##* } # submit third job with dependency: starts only if previous job terminates successfully) sbatch_output=$(sbatch --dependency=afterok:$jobid job2job3.sbatch) |
Job Arrays
Job arrays are the preferred way to submit many similar job. Jobs, for instance, if you need to run the same program on a number of input files, or with different settings or run them with a range of parameters. Arrays are created with the -a start-finish
sbatch parameter. E.g. sbatch -a 0-19
will create 20 jobs indexed from 0 to 19. There are different ways to index the arrays, which are described below.
...