Wait for set of qsub jobs to complete - Stack Overflow
$ qsub -N job1 -cwd ./job1_script
$ qsub -N job2 -cwd ./job2_script
$ qsub -N job3 -cwd ./job3_script
$ qsub -hold_jid job1,job2,job3 -cwd ./results_script
qsub
のman
-N name
Available for qsub, qsh, qrsh, qlogin and qalter only.
The name of the job. The name should follow the "name" definition in sge_types(5).
Invalid job names will be denied at submit time.
If the -N option is not present, Grid Engine assigns the name of the job script to
the job after any directory pathname has been removed from the script name. If the
script is read from standard input, the job name defaults to STDIN.
In the case of qsh or qlogin with the -N option is absent, the name "INTERACTIVE" or
"QLOGIN" respectively is assigned to the job.
In the case of qrsh if the -N option is absent, the resulting job name is determined
from the qrsh command line by using the argument string up to the first occurrence
of a semicolon or whitespace and removing the directory pathname. With no command,
"QRLOGIN" is used.
Qalter allows changing this option even while the job executes.
The value specified with this option or the corresponding value specified in qmon
will be passed to defined JSV instances as parameter with the name N. (See -jsv
option above or find more information concerning JSV in jsv(1).)
-hold_jid wc_job_list
Available for qsub, qrsh, and qalter only. See sge_types(5). For the definition of
wc_job_list.
Defines or redefines the job dependency list of the submitted job. A reference by
job name or pattern is only accepted if the referenced job is owned by the same user
as the referring job. The submitted job is not eligible for execution unless all
jobs referenced in the comma-separated job id and/or job name list have completed.
If any of the referenced jobs exits with exit code 100, the submitted job will
remain ineligible for execution.
With the help of job names or regular patterns, one can specify a job dependency on
multiple jobs satisfying the regular pattern, or on all jobs with the requested
name. The name dependencies are resolved at submit time and can only be changed via
qalter. New jobs or name changes of other jobs will not be taken into account. To
remove a job dependency list with qalter, use a null wc_job_list, i.e. use
qalter -hold_jid '' ...
Qalter allows changing this option even while the job executes. The modified parame‐
ter will only be in effect after a restart or migration of the job, however.
If this option or a corresponding value in qmon is specified then this value will be
passed to defined JSV instances as parameter with the name hold_jid. (See -jsv
option below or find more information concerning JSV in jsv(1).)