Discussion:
SLURM Job Dependency using Job Name
Brian Huynh
2014-07-17 14:47:31 UTC
Permalink
Hi,

I have two jobs encapsulated in a single bash script. I would like the second to be able to queue but not start until the first has completed. As of now, I can only get SLURM to implement this if I have the exact job ID but I will not be able to readily guess this ID once SLURM is active with normal usage.

Previously, in SGE, I used the tag -N previousjob_$1 in the qsub line for the first job and -hold_jid previousjob_$1 in the qsub line for the second job to create the job dependency.

However, SLURM does not allow for me to pass in arguments into the tag --depend=afterok:jobID while jobID contains an input argument such as $1. How should I best implement this?

Both job submissions work independently of each other without the dependency included.

Thanks for all the help and advice.

Best,
Brian
Nicolas GRANDEMANGE
2014-07-18 16:26:35 UTC
Permalink
Hi,

If the two jobs are consecutive, you can simply run the first one with
'srun' instead of 'sbatch' so it will run synchronously.

Otherwise, I believe you can explicitly name your jobs and use the
singleton dependency.

$ sbatch -J foobar test1.sh
$ sbatch -J foobar -d singleton test2.sh

Also, if you really care about the afterok dependency, you can name the
first job with -J then translate it to a job id and apply the dependency.

Regards
Post by Brian Huynh
Hi,
I have two jobs encapsulated in a single bash script. I would like the
second to be able to queue but not start until the first has completed. As
of now, I can only get SLURM to implement this if I have the exact job ID
but I will not be able to readily guess this ID once SLURM is active with
normal usage.
Previously, in SGE, I used the tag -N previousjob_$1 in the qsub line for
the first job and -hold_jid previousjob_$1 in the qsub line for the second
job to create the job dependency.
However, SLURM does not allow for me to pass in arguments into the tag
--depend=afterok:jobID while jobID contains an input argument such as $1.
How should I best implement this?
Both job submissions work independently of each other without the dependency included.
Thanks for all the help and advice.
Best,
Brian
--
Nicolas Grandemange
Loading...