Job dependencies are expressed in terms of job IDs. Upon submission of a given job via srun or sbatch, a script that submits a second, dependent job will need to know the first job's ID before it can specify the dependency on that job. The ID of a job can be found by parsing the output generated on submission, as shown with this command:

This line executes sbatch, parses the output for the job ID, and places the ID into variable JOB. With the job ID of the first job known, it then becomes easy to submit one or more dependent jobs:

It is possible to script arbitrarily complex chains of dependent jobs this way.

 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Inclusivity Statement