LSF - Get ID of submitted job

后端 未结 5 936
予麋鹿
予麋鹿 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条回答
  •  甜味超标
    2021-01-04 12:29

    Just as a reference, this is the best solution I could come up with so far. It takes advantage of the fact that bsub write a line containing the ID to STDOUT.

    function nk_jobid {
        output=$($*)
        echo $output | head -n1 | cut -d'<' -f2 | cut -d'>' -f1
    }
    

    Usage:

    jobid=$(nk_jobid bsub pwd)
    

提交回复
热议问题