Job Dependencies


There may be situations where there are obvious dependencies between jobs, and one cannot start before another has finished (for example because it is dependent on the results of the previous jobs).

The job-dependency feature that can be used for this purpose. One can therefore specify in the batch script of a job, that this job has a dependency on another one. This is done with the syntax

#PBS -W depend=afterok:<jobid>

This will ensure that the current job is started only after the job with the corresponding jobid is completed successfully. Some of the most common options are

after : job will start after the other job has started.
afterok: job will start after the other job is terminated without errors.
afternotok: job will start after the other job is terminated with errors.
afterany: job will start after the other job is terminated with or without errors.

In case of a job array, the keywords are different. For example, to have the job to start only after a complete job-array is finished without errors:

#PBS -W depend=afterokarray:<jobid>[]

To know the jobs that a job depends on, type

qstat -f <jobid> | grep depend