Skip to content
Snippets Groups Projects
Commit 563fb076 authored by Jeffrey Pullin's avatar Jeffrey Pullin
Browse files

Add script for checking of cluster status

To fix problems with timeouts failing silently.

Taken from snakemake docs.

Also add the required argument to snakemake invocation
parent ecca8316
No related branches found
No related tags found
No related merge requests found
Pipeline #6370 passed
......@@ -7,4 +7,4 @@ module load r/4.0.0
R CMD BATCH --no-save --no-restore code/simulation-pars.R logs/simulation-pars.Rout
R CMD BATCH --no-save --no-restore code/method-pars.R logs/method-pars.Rout
snakemake -s Snakefile.py --profile slurm
snakemake -s Snakefile.py --profile slurm --cluster-status status.py
#!/usr/bin/env python
import subprocess
import sys
jobid = sys.argv[1]
output = str(subprocess.check_output("sacct -j %s --format State --noheader | head -1 | awk '{print $1}'" % jobid, shell=True).strip())
running_status=["PENDING", "CONFIGURING", "COMPLETING", "RUNNING", "SUSPENDED"]
if "COMPLETED" in output:
print("success")
elif any(r in output for r in running_status):
print("running")
else:
print("failed")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment