From ec26cc185faeb79b575f2563b97cd22d8b4f553c Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 14 Nov 2023 12:54:18 +0100 Subject: [PATCH 1/3] Only start single galaxy with all runnables e.g. when testing https://github.com/galaxyproject/iwc/tree/main/workflows/data-fetching/parallel-accession-download --- planemo/engine/galaxy.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/planemo/engine/galaxy.py b/planemo/engine/galaxy.py index 1c2c6e97c..81b2e8342 100644 --- a/planemo/engine/galaxy.py +++ b/planemo/engine/galaxy.py @@ -54,12 +54,12 @@ def _run(self, runnables, job_paths, output_collectors: Optional[List[Callable]] results = [] if not output_collectors: output_collectors = [lambda x: None] * len(runnables) - for runnable, job_path, collect_output in zip(runnables, job_paths, output_collectors): - self._ctx.vlog(f"Serving artifact [{runnable}] with Galaxy.") - with self.ensure_runnables_served([runnable]) as config: - self._ctx.vlog(f"Running job path [{job_path}]") - if self._ctx.verbose: - self._ctx.log(f"Running Galaxy with API configuration [{config.user_api_config}]") + + with self.ensure_runnables_served(runnables) as config: + if self._ctx.verbose: + self._ctx.log(f"Running Galaxy with API configuration [{config.user_api_config}]") + for runnable, job_path, collect_output in zip(runnables, job_paths, output_collectors): + self._ctx.vlog(f"Serving artifact [{runnable}] with Galaxy.") run_response = execute(self._ctx, config, runnable, job_path, **self._kwds) results.append(run_response) if collect_output is not None: From cf90306a69b5b1c231ccc1480d95ee225d1fa407 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 14 Nov 2023 12:56:33 +0100 Subject: [PATCH 2/3] Fix scope of test_case Otherwise the lambda runs with the last test case only. --- planemo/engine/interface.py | 4 +++- tests/test_cmd_test.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/planemo/engine/interface.py b/planemo/engine/interface.py index f7e935eef..2649c6e7c 100644 --- a/planemo/engine/interface.py +++ b/planemo/engine/interface.py @@ -116,7 +116,9 @@ def _run_test_cases(self, test_cases, test_timeout): job_paths.append(job_path) else: job_paths.append(test_case.job_path) - output_collectors.append(lambda run_response: test_case.structured_test_data(run_response)) + output_collectors.append( + lambda run_response, test_case=test_case: test_case.structured_test_data(run_response) + ) try: run_responses = self._run(runnables, job_paths, output_collectors) finally: diff --git a/tests/test_cmd_test.py b/tests/test_cmd_test.py index 2e96bfa10..0101c027a 100644 --- a/tests/test_cmd_test.py +++ b/tests/test_cmd_test.py @@ -89,7 +89,7 @@ def test_data_manager_docker_mount(self): @skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS") def test_workflow_test_simple_yaml(self): """Test testing a simple YAML workflow with Galaxy.""" - with self._isolate(): + with self._isolate() as test_dir: random_lines = os.path.join(PROJECT_TEMPLATES_DIR, "demo", "randomlines.xml") cat = os.path.join(PROJECT_TEMPLATES_DIR, "demo", "cat.xml") test_artifact = os.path.join(TEST_DATA_DIR, "wf1.gxwf.yml") @@ -104,6 +104,9 @@ def test_workflow_test_simple_yaml(self): test_artifact, ] self._check_exit_code(test_command, exit_code=0) + with open(os.path.join(test_dir, "tool_test_output.json")) as test_json: + tests_dict = json.load(test_json) + assert tests_dict["tests"][0]["id"] != tests_dict["tests"][1]["id"] @skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS") def test_tool_test_timeout(self): From 45f516623cc26b7c206fb4b70a0955dafc692ddd Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 14 Nov 2023 14:21:35 +0100 Subject: [PATCH 3/3] Restore verbose job path logging --- planemo/engine/galaxy.py | 1 + 1 file changed, 1 insertion(+) diff --git a/planemo/engine/galaxy.py b/planemo/engine/galaxy.py index 81b2e8342..8b611f2f0 100644 --- a/planemo/engine/galaxy.py +++ b/planemo/engine/galaxy.py @@ -60,6 +60,7 @@ def _run(self, runnables, job_paths, output_collectors: Optional[List[Callable]] self._ctx.log(f"Running Galaxy with API configuration [{config.user_api_config}]") for runnable, job_path, collect_output in zip(runnables, job_paths, output_collectors): self._ctx.vlog(f"Serving artifact [{runnable}] with Galaxy.") + self._ctx.vlog(f"Running job path [{job_path}]") run_response = execute(self._ctx, config, runnable, job_path, **self._kwds) results.append(run_response) if collect_output is not None: