Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle output parsing when tool is not available for tool-centric API. #18643

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/galaxy/tool_util/parser/output_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class FilePatternDatasetCollectionDescription(DatasetCollectionDescription):


def from_tool_source(tool_source: ToolSource) -> List[ToolOutput]:
tool_outputs, tool_output_collections = tool_source.parse_outputs(object())
tool_outputs, tool_output_collections = tool_source.parse_outputs(None)
outputs = []
for tool_output in tool_outputs.values():
outputs.append(tool_output.to_model())
Expand Down
9 changes: 7 additions & 2 deletions lib/galaxy/tool_util/parser/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def parse_provided_metadata_file(self):

return provided_metadata_file

def parse_outputs(self, tool):
def parse_outputs(self, tool=None):
out_elem = self.root.find("outputs")
outputs = {}
output_collections = {}
Expand Down Expand Up @@ -558,7 +558,12 @@ def _parse_output(
# This ensures that old tools continue to work.
output.from_work_dir = output.from_work_dir.strip()
output.hidden = string_as_bool(data_elem.get("hidden", ""))
output.actions = ToolOutputActionGroup(output, data_elem.find("actions"))
if tool is not None:
# poor design here driven entirely by pragmatism in refactoring, ToolOutputActionGroup
# belongs in galaxy-tool because it uses app heavily. Breaking the output objects
# into app-aware things and dumb models would be a large project but superior design
# and decomposition.
output.actions = ToolOutputActionGroup(output, data_elem.find("actions"))
output.dataset_collector_descriptions = dataset_collector_descriptions_from_elem(
data_elem, legacy=self.legacy_defaults
)
Expand Down
9 changes: 9 additions & 0 deletions test/unit/tool_util/test_output_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from galaxy.tool_util.parser.factory import get_tool_source
from galaxy.tool_util.parser.output_models import from_tool_source
from galaxy.tool_util.unittest_utils import functional_test_tool_path


def test_from_tool_data_table():
tool_source = get_tool_source(functional_test_tool_path("dbkey_output_action.xml"))
# prevent regression of https://github.com/galaxyproject/galaxy/issues/18554. Tool fails without fix
from_tool_source(tool_source)
Loading