Niels and Andrew have answers to this particular question in shell and C / C ++ environments, respectively. For the purpose of building dependencies, you can also name your task with -J, and then build the dependency based on the name of the task:
bsub -J "job1" <cmd1> bsub -J "job2" <cmd2> bsub -w "done(job1) && done(job2)" <cmd>
Here is a bit more information here .
This also works with job arrays:
bsub -J "ArrayA[1-10]" <cmd1> bsub -J "ArrayB[1-10]" <cmd2> bsub -w "done(ArrayA[3]) && done(ArrayB[5])" <cmd>
You can even do phased addiction. The following i-th element of the task will be executed only when the corresponding element in ArrayB reaches the DONE state:
bsub -w "done(ArrayB[*])" -J "ArrayC[1-10]" <cmd3>
You can find additional information about various things that you can specify in -w here .
Squirrel
source share