From ecd67fa228450a5732f81c870779406645205ae4 Mon Sep 17 00:00:00 2001
From: Jan Siwiec <jan.siwiec@vsb.cz>
Date: Wed, 31 Mar 2021 10:25:13 +0200
Subject: [PATCH] Pbs torque dependancy job submitting

---
 .../general/job-submission-and-execution.md   | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/docs.it4i/general/job-submission-and-execution.md b/docs.it4i/general/job-submission-and-execution.md
index bc436a2aa..bfac9e184 100644
--- a/docs.it4i/general/job-submission-and-execution.md
+++ b/docs.it4i/general/job-submission-and-execution.md
@@ -60,6 +60,38 @@ By default, the PBS batch system sends an email only when the job is aborted. Di
 $ qsub -m n
 ```
 
+#### Dependency Job Submission
+
+To submit dependent jobs in sequence, use the `depend` function of `qsub`.
+
+First submit the first job in a standard manner:
+
+```console
+$ qsub -A OPEN-0-0 -q qprod -l select=64:ncpus=36,walltime=02:00:00 ./firstjob
+123456[].isrv1
+```
+
+Then submit the second job using the `depend` function:
+
+```console
+qsub -W depend=afterok:123456 ./secondjob
+```
+
+Both jobs will be queued, but the second job won't start until the first job has finished successfully.
+
+Below is the list of arguments that can be used with `-W depend=dependency:jobid`:
+
+| Argument    | Description                                                     |
+| ----------- | --------------------------------------------------------------- |
+| after       | This job is scheduled after `jobid` begins execution.       |
+| afterok     | This job is scheduled after `jobid` finishes successfully.  |
+| afternotok  | This job is scheduled after `jobid` finishes unsucessfully. |
+| afterany    | This job is scheduled after `jobid` finishes in any state.  |
+| before      | This job must begin execution before `jobid` is scheduled.  |
+| beforeok    | This job must finish successfully before `jobid` begins.        |
+| beforenotok | This job must finish unsuccessfully before `jobid` begins.      |
+| beforeany   | This job must finish in any state before `jobid` begins.        |
+
 ### Salomon - Intel Xeon Phi Co-Processors
 
 To allocate a node with Xeon Phi co-processor, the user needs to specify that in the select statement. Currently only allocation of whole nodes with both Phi cards as the smallest chunk is supported. A standard PBSPro approach through the `accelerator`, `naccelerators`, and `accelerator_model` attributes is used. The `accelerator_model` can be omitted since on Salomon, only one type of accelerator type/model is available.
-- 
GitLab