<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi,
<div class=""><br class="">
</div>
<div class="">I would recommend to use dependencies (-d) option available in sbatch or srun. </div>
<div class=""><br class="">
</div>
<div class="">You need -d afterok:jobid. Hopefully it works.</div>
<div class=""><br class="">
</div>
<div class="">Best</div>
<div class="">
<div class="">
<div dir="auto" style="color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<br class="Apple-interchange-newline">
--------------------</div>
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
Zia Ul Huda<br class="">
Forschungszentrum Jülich GmbH<br class="">
Institute for Advanced Simulation (IAS)<br class="">
Jülich Supercomputing Centre (JSC)<br class="">
Wilhelm-Johnen-Straße<br class="">
52425 Jülich, Germany<br class="">
<br class="">
Phone: +49 2461 61 96905<br class="">
<a href="mailto:z.huda@fz-juelich.de" class="">E-mail:  z.huda@fz-juelich.de</a><br class="">
<br class="">
WWW: http://www.fz-juelich.de/ias/jsc/<br class="">
<br class="">
<br class="">
JSC is the coordinator of the<br class="">
John von Neumann Institute for Computing<br class="">
and member of the<br class="">
Gauss Centre for Supercomputing <br class="">
<br class="">
--------------------</div>
</div>
</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 25. Nov 2019, at 10:12, Nigella Sanders <<a href="mailto:nigella.sanders@gmail.com" class="">nigella.sanders@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class=""><br class="">
</div>
<div class="">
<div class="">Hi all,<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">I guess this is a simple matter but I still find it confusing.</div>
<div class=""><br class="">
</div>
<div class="">I have to run 20 jobs on our supercomputer. <br class="">
Each job takes about 8 hours and every one need the previous one to be completed.<br class="">
</div>
<div class="">The queue time limit for jobs is 10 hours.</div>
<div class=""><br class="">
</div>
<div class="">So my first approach is serially launching them in a loop using srun:</div>
<div class=""><br class="">
</div>
<div class=""><b class=""><span style="font-family:monospace" class="">#!/bin/bash<br class="">
</span></b></div>
<div class=""><b class=""><span style="font-family:monospace" class="">for i in {1..20};do</span></b></div>
<div class=""><b class=""><span style="font-family:monospace" class="">    srun  --time 08:10:00  [options]<br class="">
</span></b></div>
<div class=""><b class=""><span style="font-family:monospace" class="">done<br class="">
</span></b></div>
<div class=""><b class=""><span style="font-family:monospace" class=""><br class="">
</span></b></div>
<div class="">However SLURM literature keeps saying that 'srun' should be only used for short command line tests. So that some sysadmins would consider this a bad practice (<a href="https://stackoverflow.com/questions/43767866/slurm-srun-vs-sbatch-and-their-parameters" target="_blank" class="">see
 this</a>).</div>
<div class=""><br class="">
</div>
<div class="">My second approach switched to sbatch:</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""><b class=""><span style="font-family:monospace" class="">#!/bin/bash
</span></b></div>
<div class=""><b class=""><span style="font-family:monospace" class="">for i in {1..20};do</span></b></div>
<div class=""><b class=""><span style="font-family:monospace" class="">    sbatch  --time 08:10:00 [options]</span></b></div>
<div class=""><b class=""><span style="font-family:monospace" class="">    [polling to queue to see if job is done]<br class="">
</span></b></div>
<div class=""><b class=""><span style="font-family:monospace" class="">done</span></b><br class="">
</div>
</div>
<div class=""><br class="">
</div>
<div class="">But since sbatch returns the prompt I had to add code to check for job termination. Polling make use of sleep command and it is prone to race conditions so it doesn't like to sysadmins either.</div>
<div class=""><br class="">
</div>
<div class="">I guess there must be a --wait option in some recent versions of SLURM (<a href="https://bugs.schedmd.com/show_bug.cgi?id=1685" target="_blank" class="">see this</a>). Not yet available in our system though.<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Is there any prefererable/canonical/friendly way to do this?<br class="">
</div>
Any thoughts would be really appreciated,<br class="">
<div class=""><br class="">
</div>
<div class="">Regards,<br class="">
</div>
<div class="">Nigella.
<div class="gmail-adL"><br class="">
</div>
</div>
</div>
<div class=""><br class="">
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
<br>
<font face="Arial" color="Black" size="1"><br>
------------------------------------------------------------------------------------------------<br>
------------------------------------------------------------------------------------------------<br>
Forschungszentrum Juelich GmbH<br>
52425 Juelich<br>
Sitz der Gesellschaft: Juelich<br>
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498<br>
Vorsitzender des Aufsichtsrats: MinDir Volker Rieke<br>
Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),<br>
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,<br>
Prof. Dr. Sebastian M. Schmidt<br>
------------------------------------------------------------------------------------------------<br>
------------------------------------------------------------------------------------------------<br>
<br>
</font>
</body>
</html>