From 15cf05a8a56f8f8860fce558fe16b9a3e7bbf3cf Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 1 Mar 2021 15:56:48 +0100 Subject: [PATCH 1/8] Add testcase for explicit output collection step_outputs when reaching max_num_jobs This should recapitulate the error seen when running workflow tests against https://github.com/galaxyproject/iwc/pull/23. --- .../test_workflow_scheduling_options.py | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/integration/test_workflow_scheduling_options.py b/test/integration/test_workflow_scheduling_options.py index 6c12e191727..58af3315a48 100644 --- a/test/integration/test_workflow_scheduling_options.py +++ b/test/integration/test_workflow_scheduling_options.py @@ -61,7 +61,7 @@ class MaximumWorkflowJobsPerSchedulingIterationTestCase(integration_util.Integra def handle_galaxy_config_kwds(cls, config): config["maximum_workflow_jobs_per_scheduling_iteration"] = 1 - def test(self): + def test_collection_explicit_and_implicit(self): workflow_id = self.workflow_populator.upload_yaml_workflow(""" class: GalaxyWorkflow steps: @@ -89,3 +89,40 @@ steps: self.workflow_populator.wait_for_workflow(history_id, workflow_id, invocation_id) self.dataset_populator.wait_for_history(history_id, assert_ok=True) self.assertEqual("a\nc\nb\nd\ne\ng\nf\nh\n", self.dataset_populator.get_history_dataset_content(history_id, hid=0)) + + def test_scheduling_rounds(self): + with self.dataset_populator.test_history() as history_id: + invocation_response = self.workflow_populator.run_workflow(""" +class: GalaxyWorkflow +inputs: + input1: data + text_input: text +steps: + first_cat: + tool_id: cat1 + in: + input1: input1 + second_cat: + tool_id: cat1 + in: + input1: first_cat/out_file1 + collection_creates_dynamic_list_of_pairs: + tool_id: collection_creates_dynamic_list_of_pairs + in: + file: second_cat/out_file1 + count_multi_file: + tool_id: count_multi_file + in: + input1: collection_creates_dynamic_list_of_pairs/list_output +outputs: + wf_output_1: + outputSource: collection_creates_dynamic_list_of_pairs/list_output +""", test_data=""" +input1: + value: 1.fasta + type: File + name: fasta1 +text_input: foo +""", history_id=history_id) + invocation = self._get("/invocations/{}".format(invocation_response.invocation_id)).json() + assert 'wf_output_1' in invocation['output_collections'] From 1f82927ace979075dbd1540cad3493700889492a Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 1 Mar 2021 20:02:11 +0100 Subject: [PATCH 2/8] Don't set empty step output if no job was created Fixes ``` Traceback (most recent call last): File "/Users/mvandenb/src/galaxy/lib/galaxy/workflow/run.py", line 82, in __invoke outputs = invoker.invoke() File "/Users/mvandenb/src/galaxy/lib/galaxy/workflow/run.py", line 190, in invoke incomplete_or_none = self._invoke_step(workflow_invocation_step) File "/Users/mvandenb/src/galaxy/lib/galaxy/workflow/run.py", line 263, in _invoke_step incomplete_or_none = invocation_step.workflow_step.module.execute(self.trans, File "/Users/mvandenb/src/galaxy/lib/galaxy/workflow/modules.py", line 1659, in execute collection_info = self.compute_collection_info(progress, step, all_inputs) File "/Users/mvandenb/src/galaxy/lib/galaxy/workflow/modules.py", line 335, in compute_collection_info collections_to_match = self._find_collections_to_match( File "/Users/mvandenb/src/galaxy/lib/galaxy/workflow/modules.py", line 354, in _find_collections_to_match data = progress.replacement_for_input(step, input_dict) File "/Users/mvandenb/src/galaxy/lib/galaxy/workflow/run.py", line 328, in replacement_for_input replacement = [self.replacement_for_connection(c) for c in connection] File "/Users/mvandenb/src/galaxy/lib/galaxy/workflow/run.py", line 328, in replacement = [self.replacement_for_connection(c) for c in connection] File "/Users/mvandenb/src/galaxy/lib/galaxy/workflow/run.py", line 358, in replacement_for_connection raise Exception(message) Exception: Workflow evaluation problem - failed to find output_name list_output in step_outputs {} galaxy.workflow.scheduling_manager DEBUG 2021-03-01 19:58:59,493 Workflow invocation [1] scheduled ``` --- lib/galaxy/workflow/run.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/workflow/run.py b/lib/galaxy/workflow/run.py index cf05eb39c11..a742257af13 100644 --- a/lib/galaxy/workflow/run.py +++ b/lib/galaxy/workflow/run.py @@ -173,7 +173,12 @@ class WorkflowInvoker: remaining_steps = self.progress.remaining_steps() delayed_steps = False + max_jobs_per_iteration_reached = False for (step, workflow_invocation_step) in remaining_steps: + max_jobs_to_schedule = self.progress.maximum_jobs_to_schedule_or_none + if max_jobs_to_schedule is not None and max_jobs_to_schedule <= 0: + max_jobs_per_iteration_reached = True + break step_delayed = False step_timer = ExecutionTimer() try: @@ -208,7 +213,7 @@ class WorkflowInvoker: if not step_delayed: log.debug("Workflow step {} of invocation {} invoked {}".format(step.id, workflow_invocation.id, step_timer)) - if delayed_steps: + if delayed_steps or max_jobs_per_iteration_reached: state = model.WorkflowInvocation.states.READY else: state = model.WorkflowInvocation.states.SCHEDULED From 7c8a5c18f9ddd29569e96a1e942826be991df5fe Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Tue, 10 Nov 2020 17:17:15 +0000 Subject: [PATCH 3/8] Fix command line for tools using `interpreter` when galaxy root contains spaces --- lib/galaxy/tools/evaluation.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/tools/evaluation.py b/lib/galaxy/tools/evaluation.py index 67a54927fc6..d1f8d85099f 100644 --- a/lib/galaxy/tools/evaluation.py +++ b/lib/galaxy/tools/evaluation.py @@ -1,6 +1,7 @@ import json import logging import os +import shlex import tempfile @@ -494,11 +495,12 @@ class ToolEvaluator: raise if interpreter: # TODO: path munging for cluster/dataset server relocatability - executable = command_line.split()[0] + command_line_tokens = shlex.split(command_line) + executable = command_line_tokens[0] tool_dir = os.path.abspath(self.tool.tool_dir) abs_executable = os.path.join(tool_dir, executable) - command_line = command_line.replace(executable, abs_executable, 1) - command_line = interpreter + " " + command_line + command_line_tokens[0:1] = [interpreter, abs_executable] + command_line = ' '.join(map(shlex.quote, command_line_tokens)) self.command_line = command_line def __build_config_files(self): From e79a5dfedb4a897e3ae3c5078a0850a64cf7f629 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Wed, 10 Feb 2021 18:33:07 +0000 Subject: [PATCH 4/8] Fix command line building when using interpreter Partially revert commit efa9e0fdd1d11d58f4a504a3e8242cc59f3f1416 which broke tools which use `interpreter` and `&&` or environment variables in the ``. xref.: https://github.com/galaxyproject/galaxy/pull/10674/commits/efa9e0fdd1d11d58f4a504a3e8242cc59f3f1416#r573844945 --- lib/galaxy/tools/evaluation.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/tools/evaluation.py b/lib/galaxy/tools/evaluation.py index d1f8d85099f..fd931b1689f 100644 --- a/lib/galaxy/tools/evaluation.py +++ b/lib/galaxy/tools/evaluation.py @@ -495,12 +495,10 @@ class ToolEvaluator: raise if interpreter: # TODO: path munging for cluster/dataset server relocatability - command_line_tokens = shlex.split(command_line) - executable = command_line_tokens[0] + executable = command_line.split()[0] tool_dir = os.path.abspath(self.tool.tool_dir) abs_executable = os.path.join(tool_dir, executable) - command_line_tokens[0:1] = [interpreter, abs_executable] - command_line = ' '.join(map(shlex.quote, command_line_tokens)) + command_line = command_line.replace(executable, "{} {}".format(interpreter, shlex.quote(abs_executable)), 1) self.command_line = command_line def __build_config_files(self): From 5c56704b44e3428379d6b659ede34a52d8ca5d02 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 1 Mar 2021 21:53:44 +0100 Subject: [PATCH 5/8] use if max_num_job is not None --- lib/galaxy/tools/execute.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tools/execute.py b/lib/galaxy/tools/execute.py index 37eee5d8aed..4c9cd45e993 100644 --- a/lib/galaxy/tools/execute.py +++ b/lib/galaxy/tools/execute.py @@ -34,7 +34,7 @@ def execute(trans, tool, mapping_params, history, rerun_remap_job_id=None, colle Execute a tool and return object containing summary (output data, number of failures, etc...). """ - if max_num_jobs: + if max_num_jobs is not None: assert invocation_step is not None if rerun_remap_job_id: assert invocation_step is None @@ -96,7 +96,7 @@ def execute(trans, tool, mapping_params, history, rerun_remap_job_id=None, colle execution_slice = None for i, execution_slice in enumerate(execution_tracker.new_execution_slices()): - if max_num_jobs and jobs_executed >= max_num_jobs: + if max_num_jobs is not None and jobs_executed >= max_num_jobs: has_remaining_jobs = True break else: From 6f0de082a0c4a37fcfbeba106576e51da6747df4 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 2 Mar 2021 10:33:22 +0100 Subject: [PATCH 6/8] Add logging if installable tool config file not found Should make it easier to debug failing installations like this: ``` Mar 02 09:39:41 svvm0085 uwsgi[2626501]: galaxy.tool_shed.galaxy_install.install_manager ERROR 2021-03-02 09:39:41,329 [p:2626501,w:1,m:0] [uWSGIWorker1Core0] Error installing repository 'data_manager_fetch_genome_dbkeys_all_fasta' Mar 02 09:39:41 svvm0085 uwsgi[2626501]: Traceback (most recent call last): Mar 02 09:39:41 svvm0085 uwsgi[2626501]: File "/data/galaxy/galaxy//server/lib/galaxy/tool_shed/galaxy_install/install_manager.py", line 848, in install_repositories Mar 02 09:39:41 svvm0085 uwsgi[2626501]: self.install_tool_shed_repository(tool_shed_repository, Mar 02 09:39:41 svvm0085 uwsgi[2626501]: File "/data/galaxy/galaxy//server/lib/galaxy/tool_shed/galaxy_install/install_manager.py", line 926, in install_tool_shed_repository Mar 02 09:39:41 svvm0085 uwsgi[2626501]: self.__handle_repository_contents(tool_shed_repository=tool_shed_repository, Mar 02 09:39:41 svvm0085 uwsgi[2626501]: File "/data/galaxy/galaxy//server/lib/galaxy/tool_shed/galaxy_install/install_manager.py", line 574, in __handle_repository_contents Mar 02 09:39:41 svvm0085 uwsgi[2626501]: dmh.install_data_managers(self.app.config.shed_data_manager_config_file, Mar 02 09:39:41 svvm0085 uwsgi[2626501]: File "/data/galaxy/galaxy//server/lib/galaxy/tool_shed/galaxy_install/tools/data_manager.py", line 81, in install_data_managers Mar 02 09:39:41 svvm0085 uwsgi[2626501]: relative_repo_data_manager_dir = os.path.join(shed_config_dict.get('tool_path', ''), relative_install_dir) Mar 02 09:39:41 svvm0085 uwsgi[2626501]: AttributeError: 'NoneType' object has no attribute 'get' ``` In this case there was an extra slash in the tool_path section in the tool_path attribute of the shed_tool_config_file. Includes a small fix where we check both paths to be compared using the abspath value. --- lib/galaxy/tools/toolbox/base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/tools/toolbox/base.py b/lib/galaxy/tools/toolbox/base.py index d9dc196f536..ba2f27538a9 100644 --- a/lib/galaxy/tools/toolbox/base.py +++ b/lib/galaxy/tools/toolbox/base.py @@ -264,9 +264,13 @@ class AbstractToolBox(Dictifiable, ManagesIntegratedToolPanelMixin): def get_shed_config_dict_by_filename(self, filename): filename = os.path.abspath(filename) + dynamic_tool_conf_paths = [] for shed_config_dict in self._dynamic_tool_confs: - if shed_config_dict['config_filename'] == filename: + dynamic_tool_conf_path = os.path.abspath(shed_config_dict['config_filename']) + dynamic_tool_conf_paths.append(dynamic_tool_conf_path) + if dynamic_tool_conf_path == filename: return shed_config_dict + log.warning("'{}' not among installable tool config files ({})".format(filename, ', '.join(dynamic_tool_conf_paths))) return None def update_shed_config(self, shed_conf): From 6cfd858e134ebebcbdb5aff2db58a0602a2ac258 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 2 Mar 2021 11:21:31 +0100 Subject: [PATCH 7/8] Fix embedding subworkflow This broke in 88d7c4bb798d884b410213738f1bf21ae219070b. --- client/src/components/Workflow/Editor/Node.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/Workflow/Editor/Node.vue b/client/src/components/Workflow/Editor/Node.vue index 1cbd9f3f31a..2392a623316 100644 --- a/client/src/components/Workflow/Editor/Node.vue +++ b/client/src/components/Workflow/Editor/Node.vue @@ -294,7 +294,7 @@ export default { }, setData(data) { this.config_form = data.config_form; - this.content_id = this.config_form?.id; + this.content_id = data.config_form?.id || data.content_id; this.tool_state = data.tool_state; this.errors = data.errors; this.annotation = data.annotation; From ae79ed685849c1fcb6b5e33485289b3df70cc396 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 2 Mar 2021 14:09:25 +0100 Subject: [PATCH 8/8] Test test workflow embedding in workflow editor --- .../src/components/Panels/ToolBoxWorkflow.vue | 1 + lib/galaxy/selenium/navigation.yml | 3 ++ .../selenium/test_workflow_editor.py | 31 +++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/client/src/components/Panels/ToolBoxWorkflow.vue b/client/src/components/Panels/ToolBoxWorkflow.vue index c1366af2071..ccb26197086 100644 --- a/client/src/components/Panels/ToolBoxWorkflow.vue +++ b/client/src/components/Panels/ToolBoxWorkflow.vue @@ -40,6 +40,7 @@