Large Memory Computing

Dependent Jobs

Here is an example script for running dependent jobs on Oscar.

# first job - no dependencies
jobID_1=$(sbatch | cut -f 4 -d' ')
# second job - depends on job1
jobID_2=$(sbatch --dependency=afterok:$jobID_1 | cut -f 4 -d' ')
# third job - depends on job2
sbatch --dependency=afterany:$jobID_2

There are 3 batch jobs. Each job has it's own batch script:, job2,sh, The script above ( submits the three jobs.

line 4: job1 is submitted.

line 7: job2 depends on job1 finishing successfully.

line 10: job3 depends on job2 finishing successfully.

To use the above script to submit the 3 jobs, run the script as follows:


For details on the types of dependencies you can use in slurm see the sbatch manual page.