Dependency conditions

The following dependency conditions can be used with any job:
  • done(job_ID | "job_name")
  • ended(job_ID | "job_name")
  • exit(job_ID [,[op] exit_code])
  • exit("job_name"[,[op] exit_code])
  • external(job_ID | "job_name", "status_text")
  • job_ID | "job_name"
  • post_done(job_ID | "job_name")
  • post_err(job_ID | "job_name")
  • started(job_ID | "job_name")

done

Syntax

done(job_ID | "job_name")

Description

The job state is DONE.

ended

Syntax

ended(job_ID | "job_name")

Description

The job state is EXIT or DONE.

exit

Syntax

exit(job_ID | "job_name"[,[operator] exit_code])

where operator represents one of the following relational operators:

>

>=

<

<=

==

!=

Description

The job state is EXIT, and the job’s exit code satisfies the comparison test.

If you specify an exit code with no operator, the test is for equality (== is assumed).

If you specify only the job, any exit code satisfies the test.

Examples

exit (myjob)

The job named myjob is in the EXIT state, and it does not matter what its exit code was.

exit (678,0)

The job with job ID 678 is in the EXIT state, and terminated with exit code 0.

exit ("678",!=0)

The job named 678 is in the EXIT state, and terminated with any non-zero exit code.

external

Syntax

external(job_ID | "job_name", "status_text")

Specify the first word of the job status or message description (no spaces). Only the first word is evaluated.

Description

The job has the specified job status, or the text of the job’s status begins with the specified word.

Job ID or job name

Syntax

job_ID | "job_name"

Description

If you specify a job without a dependency condition, the test is for the DONE state (LSF assumes the “done” dependency condition by default).

post_done

Syntax

post_done(job_ID | "job_name")

Description

The job state is POST_DONE (the post-processing of specified job has completed without errors).

post_err

Syntax

post_err(job_ID | "job_name")

Description

The job state is POST_ERR (the post-processing of specified job has completed with errors).

started

Syntax

started(job_ID | "job_name")

Description
The job state is:
  • USUSP, SSUSP, DONE, or EXIT
  • RUN and the job has a pre-execution command that is done.

Advanced dependency conditions

If you use job arrays, you can specify additional dependency conditions that only work with job arrays.

To use other dependency conditions with array jobs, specify elements of a job array in the usual way.

Job dependency examples

bsub -J "JobA" -w 'done(JobB)' command

The simplest kind of dependency expression consists of only one dependency condition. For example, if JobA depends on the successful completion of JobB, submit the job as shown.

-w 'done(312) && (started(Job2)||exit("99Job"))'

The submitted job will not start until the job with the job ID of 312 has completed successfully, and either the job named Job2 has started, or the job named 99Job has terminated abnormally.

-w "210"

The submitted job will not start unless the job named 210 is finished.