To mitigate a lockfile problem until I find a proper solution, I would like to instruct LSF to put at most one of my jobs per host. The -x flag ensures my job has exclusive use of a host, but I do not need this; I am fine sharing with others. I just don't want to share with myself.
How can I make sure that at most one of my jobs is run on a particular host, without asking for exclusive use of the entire host?
You could use a general limit based on project. Use PER_HOST=all, JOBS=1. Then attach your jobs to that project name. The LSF admin needs to set this up.
Basically, add this to
lsb.resources
Submit your jobs with
bsub -P myproject ...
.If you don't have LSF admin access. Then a slightly kludgy way to do the same thing is to use the host exclude feature.
bsub -Q "EXCLUDE(55)" ...
When your job starts, if another job of the same type is running, exit with code 55. Then LSF will requeue the job and add that host to a job specific black list. The exit code can be something else other than 55, but avoid using exit codes with special meaning to the shell.