Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dependency chapter #2

Merged
merged 3 commits into from Jul 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 30 additions & 1 deletion doc/source/examples.rst
Expand Up @@ -288,4 +288,33 @@ Serial Job Array
Dependencies
------------

.. warning:: **WORK IN PROGRESS!**
SLURM allows the jobs dependency adding a simple flag to the `sbatch` command
.. code-block:: console
sbatch --dependency=<type:jobid[:jobid][,type:jobid[:jobid]]> ...

.. table::
:align: center
:widths: 1 3

+----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+
| Command | Meaning |
+==============================================+=============================================================================================================================+
| ``after:jobid`` | job can begin after the specified jobs have started |
+----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+
| ``afterany:jobid`` | job can begin after the specified jobs have terminated |
+----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+
| ``afternotok:jobid`` | job can begin after the specified jobs have failed |
+----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+
| ``afterok:jobid`` | job can begin after the specified jobs have run to completion with an exit code of zero (see the user guide for caveats). |
+----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+
| ``singleton`` | jobs can begin execution after all previously launched jobs with the same name and user have ended. |
+----------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------+

A command that I found usefull suppose you have ``n`` jobs that are dependent and for each ``i-th`` job you have a script called job_i.sh, then you can use the following command:

.. code-block:: console

ID=($(sbatch job_1.sh ))
for i in $(seq 2 n ); do
ID=($(sbatch --dependency=type:${ID[3]} job_$i.sh ))
done