LSF - Get ID of submitted job

后端 未结 5 934
予麋鹿
予麋鹿 2021-01-04 12:16

Say I submit a job using something like bsub pwd. Now I would like to get the job ID of that job in order to build a dependency for the next job. Is there some

5条回答
  •  梦毁少年i
    2021-01-04 12:45

    Nils and Andrey have the answers to this specific question in shell and C/C++ environments respectively. For the purposes of building dependencies, you can also name your job with -J then build the dependency based on the job name:

    bsub -J "job1" 
    bsub -J "job2" 
    bsub -w "done(job1) && done(job2)" 
    

    There's a bit more info here.

    This also works with job arrays:

    bsub -J "ArrayA[1-10]" 
    bsub -J "ArrayB[1-10]" 
    bsub -w "done(ArrayA[3]) && done(ArrayB[5])" 
    

    You can even do element-by-element dependency. The following job's i-th element will only run when the corresponding element in ArrayB reaches DONE status:

    bsub -w "done(ArrayB[*])" -J "ArrayC[1-10]" 
    

    You can find more info on the various things you can specify in -w here.

提交回复
热议问题