From cece32d168fce799bfcaa528ddc832f568968250 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sat, 10 Feb 2024 12:10:28 +0100 Subject: [PATCH] Sandwich IT entry point creating after param_dict building and env var creation --- lib/galaxy/jobs/__init__.py | 4 +--- lib/galaxy/tools/evaluation.py | 36 +++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/lib/galaxy/jobs/__init__.py b/lib/galaxy/jobs/__init__.py index fcce9e0b738e..22b8769a671e 100644 --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -1255,11 +1255,9 @@ def get_special(): self.version_command_line, self.extra_filenames, self.environment_variables, + self.interactivetools, ) = tool_evaluator.build() job.command_line = self.command_line - if hasattr(self.app, "interactivetool_manager"): - self.interactivetools = tool_evaluator.populate_interactivetools() - self.app.interactivetool_manager.create_interactivetool(job, self.tool, self.interactivetools) # Ensure galaxy_lib_dir is set in case there are any later chdirs self.galaxy_lib_dir # noqa: B018 diff --git a/lib/galaxy/tools/evaluation.py b/lib/galaxy/tools/evaluation.py index d06af3b01d53..7f464b9dbd7b 100644 --- a/lib/galaxy/tools/evaluation.py +++ b/lib/galaxy/tools/evaluation.py @@ -121,6 +121,7 @@ def __init__(self, app: MinimalToolApp, tool, job, local_working_directory): self.environment_variables: List[Dict[str, str]] = [] self.version_command_line: Optional[str] = None self.command_line: Optional[str] = None + self.interactivetools: List[Dict[str, Any]] = [] def set_compute_environment(self, compute_environment: ComputeEnvironment, get_special: Optional[Callable] = None): """ @@ -514,7 +515,12 @@ def rewrite_unstructured_paths(input_values, input): # the paths rewritten. self.__walk_inputs(self.tool.inputs, param_dict, rewrite_unstructured_paths) - def populate_interactivetools(self): + def _create_interactivetools_entry_points(self): + if hasattr(self.app, "interactivetool_manager"): + self.interactivetools = self._populate_interactivetools_template() + self.app.interactivetool_manager.create_interactivetool(self.job, self.tool, self.interactivetools) + + def _populate_interactivetools_template(self): """ Populate InteractiveTools templated values. """ @@ -575,10 +581,18 @@ def build(self): global_tool_logs(self._build_param_file, config_file, "Building Param File") global_tool_logs(self._build_command_line, config_file, "Building Command Line") global_tool_logs(self._build_version_command, config_file, "Building Version Command Line") + global_tool_logs( + self._create_interactivetools_entry_points, config_file, "Building Interactive Tool Entry Points" + ) global_tool_logs(self._build_environment_variables, config_file, "Building Environment Variables") - return self.command_line, self.version_command_line, self.extra_filenames, self.environment_variables + return ( + self.command_line, + self.version_command_line, + self.extra_filenames, + self.environment_variables, + self.interactivetools, + ) - def _build_command_line(self): """ Build command line to invoke this tool given a populated param_dict """ @@ -823,7 +837,13 @@ class PartialToolEvaluator(ToolEvaluator): def build(self): config_file = self.tool.config_file global_tool_logs(self._build_environment_variables, config_file, "Building Environment Variables") - return self.command_line, self.version_command_line, self.extra_filenames, self.environment_variables + return ( + self.command_line, + self.version_command_line, + self.extra_filenames, + self.environment_variables, + self.interactivetools, + ) class RemoteToolEvaluator(ToolEvaluator): @@ -841,4 +861,10 @@ def build(self): global_tool_logs(self._build_param_file, config_file, "Building Param File") global_tool_logs(self._build_command_line, config_file, "Building Command Line") global_tool_logs(self._build_version_command, config_file, "Building Version Command Line") - return self.command_line, self.version_command_line, self.extra_filenames, self.environment_variables + return ( + self.command_line, + self.version_command_line, + self.extra_filenames, + self.environment_variables, + self.interactivetools, + )