From 28df641054e62d4a2817830e79dad0a3526a5524 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Sat, 19 Oct 2024 10:22:59 +0200 Subject: [PATCH] cwl slurm memory test: simplify --- src/toil/test/cwl/cwlTest.py | 3 +- src/toil/test/cwl/measure_default_memory.cwl | 29 ++++++-------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/toil/test/cwl/cwlTest.py b/src/toil/test/cwl/cwlTest.py index 6ae98ccf6a..c116cb16eb 100644 --- a/src/toil/test/cwl/cwlTest.py +++ b/src/toil/test/cwl/cwlTest.py @@ -476,7 +476,6 @@ def test_slurm_node_memory(self) -> None: "--outdir", self.outDir, os.path.join(self.rootDir, "src/toil/test/cwl/measure_default_memory.cwl"), - os.path.join(self.rootDir, "src/toil/test/cwl/empty.json"), ] try: log.debug("Start test workflow") @@ -497,7 +496,7 @@ def test_slurm_node_memory(self) -> None: else: out = json.loads(output) log.debug("Workflow output: %s", out) - memory_string = open(out["memory"]["location"][len("file://") :]).read() + memory_string = out["memory"] log.debug("Observed memory: %s", memory_string) result = int(memory_string) # We should see more than the CWL default or the Toil default, assuming Slurm nodes of reasonable size (3 GiB). diff --git a/src/toil/test/cwl/measure_default_memory.cwl b/src/toil/test/cwl/measure_default_memory.cwl index bb73f2cfdd..e322899527 100644 --- a/src/toil/test/cwl/measure_default_memory.cwl +++ b/src/toil/test/cwl/measure_default_memory.cwl @@ -1,23 +1,12 @@ cwlVersion: v1.2 -class: Workflow - +class: CommandLineTool inputs: [] - -steps: - measure: - run: - class: CommandLineTool - inputs: [] - baseCommand: ["bash", "-c", "ulimit -m"] - outputs: - memory: stdout - in: [] - out: - # There's no good way to go back from a command output to a CWL value - # without bringing in a bunch of JS. - - id: memory - +baseCommand: ["bash", "-c", "ulimit -m"] +stdout: memory.txt outputs: - - id: memory - type: File - outputSource: measure/memory + memory: + type: string + outputBinding: + glob: memory.txt + loadContents: True + outputEval: $(self[0].contents)