I am running python scripts on a computing cluster (slurm) with two stages and they are sequential. I wrote two python scripts, one for Stage 1 and another for Stage 2. Every morning I check if all Stage 1 jobs are completed visually. Only then, I start Stage 2.
Is there a more elegant/automated way by combining all stages and job management in a single python script? How can I tell if the job has completed?
The workflow is similar to the following:
while not job_list.all_complete():
for job in job_list:
if job.empty():
job.submit_stage1()
if job.complete_stage1():
job.submit_stage2()
sleep(60)