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

[24.0] Fix subwofklow tags serialization type #18456

Merged
merged 2 commits into from
Jun 29, 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
6 changes: 3 additions & 3 deletions lib/galaxy/managers/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ def _workflow_to_dict_export(self, trans, stored=None, workflow=None, internal=F
If `allow_upgrade`, the workflow and sub-workflows might use updated tool versions when refactoring.
"""
annotation_str = ""
tag_str = ""
tags_list = []
annotation_owner = None
if stored is not None:
if stored.id:
Expand All @@ -1424,7 +1424,7 @@ def _workflow_to_dict_export(self, trans, stored=None, workflow=None, internal=F
or self.get_item_annotation_str(trans.sa_session, annotation_owner, stored)
or ""
)
tag_str = stored.make_tag_string_list()
tags_list = stored.make_tag_string_list()
else:
# dry run with flushed workflow objects, just use the annotation
annotations = stored.annotations
Expand All @@ -1437,7 +1437,7 @@ def _workflow_to_dict_export(self, trans, stored=None, workflow=None, internal=F
data["format-version"] = "0.1"
data["name"] = workflow.name
data["annotation"] = annotation_str
data["tags"] = tag_str
data["tags"] = tags_list
if workflow.uuid is not None:
data["uuid"] = str(workflow.uuid)
steps: Dict[int, Dict[str, Any]] = {}
Expand Down
7 changes: 7 additions & 0 deletions lib/galaxy_test/api/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -7613,6 +7613,13 @@ def _all_user_invocation_ids(self):
invocation_ids = [i["id"] for i in all_invocations_for_user.json()]
return invocation_ids

def test_subworkflow_tags(self):
workflow = self.workflow_populator.load_workflow_from_resource("test_subworkflow_with_tags")
workflow_id = self.workflow_populator.create_workflow(workflow)
downloaded_workflow = self._download_workflow(workflow_id)
subworkflow = downloaded_workflow["steps"]["1"]["subworkflow"]
assert subworkflow["tags"] == []


class TestAdminWorkflowsApi(BaseWorkflowsApiTestCase):
require_admin_user = True
Expand Down
134 changes: 134 additions & 0 deletions lib/galaxy_test/base/data/test_subworkflow_with_tags.ga
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"a_galaxy_workflow": "true",
"annotation": "Test main ",
"comments": [],
"format-version": "0.1",
"name": "Unnamed Workflow",
"report": {
"markdown": "\n# Workflow Execution Report\n\n## Workflow Inputs\n```galaxy\ninvocation_inputs()\n```\n\n## Workflow Outputs\n```galaxy\ninvocation_outputs()\n```\n\n## Workflow\n```galaxy\nworkflow_display()\n```\n"
},
"steps": {
"0": {
"annotation": "",
"content_id": null,
"errors": null,
"id": 0,
"input_connections": {},
"inputs": [],
"label": null,
"name": "Input dataset",
"outputs": [],
"position": {
"left": 0,
"top": 0
},
"tool_id": null,
"tool_state": "{\"optional\": false, \"tag\": null}",
"tool_version": null,
"type": "data_input",
"uuid": "967583e9-d2a6-444a-ba31-6fb749d03f9e",
"when": null,
"workflow_outputs": []
},
"1": {
"annotation": "",
"id": 1,
"input_connections": {
"0:Input dataset": {
"id": 0,
"input_subworkflow_step_id": 0,
"output_name": "output"
}
},
"inputs": [],
"label": null,
"name": "Workflow with tags",
"outputs": [],
"position": {
"left": 249,
"top": 51
},
"subworkflow": {
"a_galaxy_workflow": "true",
"annotation": "",
"comments": [],
"format-version": "0.1",
"name": "Workflow with tags",
"report": {
"markdown": "\n# Workflow Execution Report\n\n## Workflow Inputs\n```galaxy\ninvocation_inputs()\n```\n\n## Workflow Outputs\n```galaxy\ninvocation_outputs()\n```\n\n## Workflow\n```galaxy\nworkflow_display()\n```\n"
},
"steps": {
"0": {
"annotation": "",
"content_id": null,
"errors": null,
"id": 0,
"input_connections": {},
"inputs": [],
"label": null,
"name": "Input dataset",
"outputs": [],
"position": {
"left": 0,
"top": 0.0
},
"tool_id": null,
"tool_state": "{\"optional\": false, \"tag\": null}",
"tool_version": null,
"type": "data_input",
"uuid": "eca9b088-ff50-4253-8387-01512f03ff2f",
"when": null,
"workflow_outputs": []
},
"1": {
"annotation": "",
"content_id": "addValue",
"errors": null,
"id": 1,
"input_connections": {
"input": {
"id": 0,
"output_name": "output"
}
},
"inputs": [
{
"description": "runtime parameter for tool Add column",
"name": "input"
}
],
"label": null,
"name": "Add column",
"outputs": [
{
"name": "out_file1",
"type": "input"
}
],
"position": {
"left": 123,
"top": 112.0
},
"post_job_actions": {},
"tool_id": "addValue",
"tool_state": "{\"exp\": \"1\", \"input\": {\"__class__\": \"RuntimeValue\"}, \"iterate\": \"no\", \"__page__\": null, \"__rerun_remap_job_id__\": null}",
"tool_version": "1.0.0",
"type": "tool",
"uuid": "7016e754-149b-402a-bb17-eb6cd4b1ab0a",
"when": null,
"workflow_outputs": []
}
},
"uuid": "c33370a9-188f-4af8-bfcc-137c577c79ba"
},
"tool_id": null,
"type": "subworkflow",
"uuid": "90bdcd13-418a-49da-847e-02926942bf4b",
"when": null,
"workflow_outputs": []
}
},
"tags": [],
"uuid": "64d7fac3-6402-412b-9db6-490ffc18e129",
"version": 1
}
Loading