Basics of the situation are that I'm using Python's subprocess module to run a SLURM script which submits a number of jobs to a queue on some HPC resources that I use. I would like the Python script to wait until all the jobs submitted are finished. I tried doing this with:
proc = subprocess.Popen(['sbatch slurm.sh'],shell=True)
proc.wait()
However, it only waits for the jobs to be submitted and not for all the jobs to finish. Anyone have any suggestions for how to make this work?
Note: One idea I had was potentially having subprocess communicate somehow with the .out file produced by the SLURM script (and wait for that to finish being edited maybe?), but I'm not sure how that would work.
Thanks for any ideas!