Sequential Job Submission

For situations where you need to run several jobs back-to-back, with each waiting for the prior job’s completion, you can use the -K option with bsub.  This will have LSF wait until the job finishes before it accepts another job.

Example…

#!/bin/bash
bsub -K -o out.1 sleep 10 &
bsub -K -o out.2 sleep 5 &
wait

From the man page…

Submits a batch job and waits for the job to complete. Sends the message “Waiting for dispatch” to the terminal when you submit the job. Sends the message “Job is finished” to the terminal when the job is done. If LSB_SUBK_SHOW_EXEC_HOST is enabled in lsf.conf, also sends the message “Starting on execution_host” when the job starts running on the execution host.

You are not able to submit another job until the job is completed. This is useful when completion of the job is required to proceed, such as a job script. If the job needs to be rerun due to transient failures, bsub returns after the job finishes successfully. bsub exits with the same exit code as the job so that job scripts can take appropriate actions based on the exit codes. bsub exits with value 126 if the job was terminated while pending.

You may also like...

Leave a Reply