From 7138ded7de66b4e095c3435c5805971ee952c570 Mon Sep 17 00:00:00 2001 From: Kevin Sayers Date: Wed, 28 Aug 2024 21:55:53 -0600 Subject: [PATCH] compare all tasks with the same name and keep the max resources --- omics/cli/run_analyzer/__main__.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/omics/cli/run_analyzer/__main__.py b/omics/cli/run_analyzer/__main__.py index dcbf73b..459d780 100755 --- a/omics/cli/run_analyzer/__main__.py +++ b/omics/cli/run_analyzer/__main__.py @@ -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: @@ -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)