Child pages
  • Submitting a job - Job dependencies
Skip to end of metadata
Go to start of metadata

Jobs are submitted with the qsub command:

$ qsub options job-script

The options tell Torque information about the job, such as what resources will be needed. These can be specified in the job-script as PBS directives, or on the command line as options, or both (in which case the command line options take precedence should the two contradict each other). For each option there is a corresponding PBS directive with the syntax:

#PBS option

For example, you can specify that a job needs 2 nodes and 8 cores on each node by adding to the script the directive:

or as a command-line option to qsub when you submit the job: 

$ qsub -l nodes=2:ppn=8 my_script.q

PBS directives and qsub options for job dependencies and delayed-start jobs

Options for delaying starting a job:

  • -W depend=afterok:jobid
    Delay starting this job until jobid has completed successfully.
  • -a [MM[DD]]hhmm
    Delay starting this job until after the specified date and time. Month (MM) and day-of-month (DD) are optional, hour and minute are required. 

If you have jobs which must not be started until some other job has begun, completed or failed, you can set up a job dependency with -W depend=dependency. The most common dependency is "afterok", the job can start only after another job has completed with an exit code of zero (ie no errors). For example, to wait until job 12345 has completed successfully before starting:

Other types of job dependencies, including dependencies on job arrays, can be found with "man qsub".

Job dependencies are useful when you have one job postprocessing the results of other jobs. Job dependencies also allow you to reserve resources more efficiently: such as single-CPU postprocessing of the result of a large parallel job.

Similarly, you can instruct Torque to not start a job before a given date and time by the command line option or PBS directive -a hhmm. The date/time format accepts day, month and year too. For example, to delay starting a job until midday on the first day of the next month:

 

 

  • No labels