Skip to content

Commit

Permalink
fix conversion of resource units
Browse files Browse the repository at this point in the history
  • Loading branch information
SilasK committed May 4, 2023
1 parent c2bc0ab commit 408aead
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -402,21 +402,25 @@ onerror:
### pepulate resources for rules that don't have

for r in workflow.rules:
if not "mem" in r.resources:
r.resources["mem"] = config["mem"]
if not "mem_mb" in r.resources:

if "mem" in r.resources:
r.resources["mem_mb"] = r.resources["mem"] * 1000
else:
r.resources["mem_mb"] = config["mem"]*1000

# snakemake has a new name for that
if not "mem_mib" in r.resources:
r.resources["mem_mib"] = r.resources["mem_mb"]

# add time if ot present. Simple jobs use simple time

if "time_min" not in r.resources:
if "time" in r.resources:
r.resources["time_min"] = r.resources["time"] * 60
else:
if r.resources["mem"] <= config["simplejob_mem"]:
r.resources["time_min"] = config["runtime"]["simplejob"] * 60
else:
r.resources["time_min"] = config["runtime"]["default"] * 60
r.resources["time_min"] = config["runtime"]["default"] * 60


# convert to new units
r.resources["mem_mb"] = r.resources["mem"] * 1000
if not "runtime" in r.resources:
r.resources["runtime"] = r.resources["time_min"] * 60
r.resources["runtime"] = r.resources["time_min"]

0 comments on commit 408aead

Please sign in to comment.