Update Job Dependencies authored by Alain O' Miniussi's avatar Alain O' Miniussi
### Job en tranche
Il faut soumettre chaque tranche avec les dépendance qui vont bien, par exemple:
> sbatch --dependancy=afterany:<jobid> script.slurm
You may wish to specify dependencies between jobs for various reasons, including
* checkpoint/restart: if you job takes more than the time limit, you'll need to split it in sub steps and launch step $`N+1`$ only when step $`N`$ successfully completed.
* multi stage work: you work might be divided in different stages, each of which might not use te same resources. Again, stage $`N+1`$ must wait for successful completion of stage $`N`$.
This can be achieved with the '--dependancy' option of [sbatch](https://slurm.schedmd.com/sbatch.html) command.
Lance la première tranche et renvoi un numéro de job 'jobid':
First, you launch you first jobs (you can have one or more):
```
[alainm@castor rel]$ sbatch -p fdr ./usefull.slurm
Submitted batch job 16388602
[alainm@castor rel]$ sbatch -p fdr ./usefull.slurm
Submitted batch job 16388603
[alainm@castor rel]$
```
This will provide you with the job ids, here 16388602 and 16388603.
> sbatch --dependancy=afterany:<jobid>:<autrejobid> script.slurm
\ No newline at end of file
You can then launch another job, requiring that it only be launch once the previous jobs successfully completed:
```
$ sbatch --dependancy=after:16388602:16388603 ./usefull2.slurm
```
There are many more ways to specify dependencies explained in the [sbatch man page](https://slurm.schedmd.com/sbatch.html).
\ No newline at end of file