title: Pausing an os.system command over a slurm scheduler if the first command doesn't allocate
body: <p>I am running a script multiple times over a multinode cluster, and this script processes data sequentially over the cluster. Here is the code:</p>
  <pre><code>import os
  os.system(&quot;srun -p rs2 --mem-per-cpu 200G -t 7-23:00:00 python3 /home/usr/Sim/sim.py aok; srun -p rs2 python3 boguspython.py&quot;)
  </code></pre>
  <p>The issue is that if the first statement i.e.</p>
  <blockquote>
  <p>srun -p rs2 --mem-per-cpu 200G -t 7-23:00:00 python3 /home/usr/Sim/sim.py aok</p>
  </blockquote>
  <p>needs to wait for an allocation of resources, then the second statement immediately executes. The second command I have relies on the first command being fully executed. Is there a way to make the second statement wait until the first statement allocates and fully finishes?</p>