<div dir="ltr"><div><br></div><div>
<div>Hi all,<br></div><div><br></div><div>I guess this is a simple matter but I still find it confusing.</div><div><br></div><div>I have to run 20 jobs on our supercomputer. <br>Each job takes about 8 hours and every one need the previous one to be completed.<br></div><div>The queue time limit for jobs is 10 hours.</div><div><br></div><div>So my first approach is serially launching them in a loop using srun:</div><div><br></div><div><b><span style="font-family:monospace">#!/bin/bash<br></span></b></div><div><b><span style="font-family:monospace">for i in {1..20};do</span></b></div><div><b><span style="font-family:monospace">    srun  --time 08:10:00  [options]<br></span></b></div><div><b><span style="font-family:monospace">done<br></span></b></div><div><b><span style="font-family:monospace"><br></span></b></div><div>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">see this</a>).</div><div><br></div><div>My second approach switched to sbatch:</div><div><br></div><div>
<div><b><span style="font-family:monospace">
#!/bin/bash

</span></b></div><div><b><span style="font-family:monospace">for i in {1..20};do</span></b></div><div><b><span style="font-family:monospace">    sbatch 
--time 08:10:00

 [options]</span></b></div><div><b><span style="font-family:monospace">    [polling to queue to see if job is done]<br></span></b></div><div><b><span style="font-family:monospace">done</span></b><br></div>

</div><div><br></div><div>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><br></div><div>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">see this</a>). Not yet available in our system though.<br></div><div><br></div><div>Is there any prefererable/canonical/friendly way to do this?<br></div>Any thoughts would be really appreciated,<br><div><br></div><div>Regards,<br></div><div>Nigella.<div class="gmail-adL"><br></div></div></div><div><br>

</div></div>