Skip to content

Commit

Permalink
compare all tasks with the same name and keep the max resources
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-ktsayers committed Aug 29, 2024
1 parent bd9fc16 commit 7138ded
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion omics/cli/run_analyzer/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,14 @@ def create_config(engine, task_resources, filename):
out.write(task_string)

elif engine == 'CWL':
pass
with open(filename, "w") as out:
for task in task_resources:
task_string = textwrap.dedent(f"""
{task}:
coresMin: {task_resources[task]['cpus']}
ramMin: {task_resources[task]['mem']}
""")
out.write(task_string)
elif engine == 'WDL':
pass
else:
Expand Down Expand Up @@ -561,6 +568,11 @@ def tocsv(val):
'cpus': metrics['recommendedCpus'],
'mem': metrics['recommendedMemoryGiB']
}
else:
config[task_name] ={
'cpus': max(metrics['recommendedCpus'], config[task_name]['cpus']),
'mem': max(metrics['recommendedMemoryGiB'], config[task_name]['mem'])
}
row = [tocsv(metrics.get(h, res.get(h))) for h in hdrs]
writer.writerow(row)

Expand Down

0 comments on commit 7138ded

Please sign in to comment.