Skip to content

Instantly share code, notes, and snippets.

@brwnj
Created March 6, 2013 19:40
Show Gist options
  • Save brwnj/5102383 to your computer and use it in GitHub Desktop.
Save brwnj/5102383 to your computer and use it in GitHub Desktop.
command line usage example of bsub
#!/usr/bin/env bash
#BSUB -J example
JOBIDS=""
# example loop
for (( i = 0; i < 10; i++ )); do
RUNSCRIPT=example.sh
echo "#! /usr/bin/env bash" > $RUNSCRIPT
echo "#BSUB -J example_slave" >> $RUNSCRIPT
echo "sleep 3" >> $RUNSCRIPT
# submit the job
JOB=$(bsub < $RUNSCRIPT)
# get the id
JOBID=$(echo $JOB | sed -rn 's/.*<([0-9]+)>.*/\1/p')
# add the job id to a space delimited string
JOBIDS="$JOBIDS $JOBID"
done
# wait for completion
python -m bsub $JOBIDS
# do more stuff
echo "dependencies complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment