NERSCPowering Scientific Discovery Since 1974

Batch Jobs

Job Steps and Dependencies

There is a qsub option -W depend=dependency_list and a Torque Keyword #PBS -W depend=dependency_list for job dependencies. The most commonly used dependency_list would be afterok:jobid[:jobid...], which means the job just submitted will be executed only after the dependent job(s) terminated without an error. Another option would be afterany:jobid[:jobid...], which means the job just submitted will be executed only after the dependent job(s) terminated either with or without an error. The second option could be useful in many restart runs if it is the user's intention to exceed wall clock limit for the first job.

Note that the job id in the "-W depend=" line, could be in the format of a complete job (jobid@torque_server), such as 164894.edique02@edique02, or 164894.edique02, or just 164894.

For example, to run batch job2 only after batch job1 is completed:

edison02% qsub job1
164894.edique02
edison02% qsub -W depend=afterok:164894 job2
or
edison02% qsub -W depend=afterany:164894 job2  

Job steps and dependencies can be used in a workflow to prepare input data for simulation or to archive output data after a simulation. See the Job Steps and Dependencies example in Example Batch Scripts.