Skip to content

Commit

Permalink
Merge pull request #1391 from lldelisle/wf_same_output_name
Browse files Browse the repository at this point in the history
Try to fix planemo test workflow when output is collection with identical name
  • Loading branch information
mvdbeek authored Oct 6, 2023
2 parents 095f778 + a4dead4 commit 9daa9ba
Show file tree
Hide file tree
Showing 5 changed files with 196 additions and 1 deletion.
2 changes: 1 addition & 1 deletion planemo/galaxy/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def outputs_dict(self):

def download_output_to(self, ctx, dataset_details, output_directory, filename=None):
if filename is None:
local_filename = sanitize_filename(dataset_details.get("cwl_file_name") or dataset_details.get("name"))
local_filename = f'{sanitize_filename(dataset_details.get("cwl_file_name") or dataset_details.get("name"))}__{dataset_details["uuid"]}'
else:
local_filename = filename
destination = os.path.join(output_directory, local_filename)
Expand Down
17 changes: 17 additions & 0 deletions tests/data/wf_same_name_outputs-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- doc: Test outline for Test-workflow
job:
input text file with numbers:
class: File
path: wf_same_name_outputs_input.txt
filetype: txt
outputs:
output:
element_tests:
split_file_000000.txt:
asserts:
has_n_lines:
n: 1
split_file_000001.txt:
asserts:
has_n_lines:
n: 2
167 changes: 167 additions & 0 deletions tests/data/wf_same_name_outputs.ga
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{
"a_galaxy_workflow": "true",
"annotation": "Workflow with multiple output with identical names",
"format-version": "0.1",
"name": "Test workflow",
"steps": {
"0": {
"annotation": "input text file with numbers, one per line",
"content_id": null,
"errors": null,
"id": 0,
"input_connections": {},
"inputs": [
{
"description": "input text file with numbers, one per line",
"name": "input text file with numbers"
}
],
"label": "input text file with numbers",
"name": "Input dataset",
"outputs": [],
"position": {
"left": 0,
"top": 46
},
"tool_id": null,
"tool_state": "{\"optional\": false, \"tag\": null}",
"tool_version": null,
"type": "data_input",
"uuid": "a659f5f4-cde9-46d5-8b9b-4dec7be29393",
"when": null,
"workflow_outputs": []
},
"1": {
"annotation": "",
"content_id": "toolshed.g2.bx.psu.edu/repos/bgruening/split_file_to_collection/split_file_to_collection/0.5.0",
"errors": null,
"id": 1,
"input_connections": {
"split_parms|input": {
"id": 0,
"output_name": "output"
}
},
"inputs": [],
"label": null,
"name": "Split file",
"outputs": [
{
"name": "list_output_txt",
"type": "input"
}
],
"position": {
"left": 280,
"top": 30
},
"post_job_actions": {
"HideDatasetActionlist_output_txt": {
"action_arguments": {},
"action_type": "HideDatasetAction",
"output_name": "list_output_txt"
}
},
"tool_id": "toolshed.g2.bx.psu.edu/repos/bgruening/split_file_to_collection/split_file_to_collection/0.5.0",
"tool_shed_repository": {
"changeset_revision": "6cbe2f30c2d7",
"name": "split_file_to_collection",
"owner": "bgruening",
"tool_shed": "toolshed.g2.bx.psu.edu"
},
"tool_state": "{\"split_parms\": {\"select_ftype\": \"txt\", \"__current_case__\": 5, \"input\": {\"__class__\": \"ConnectedValue\"}, \"select_mode\": {\"mode\": \"chunk\", \"__current_case__\": 0, \"chunksize\": \"1\"}, \"newfilenames\": \"split_file\", \"select_allocate\": {\"allocate\": \"byrow\", \"__current_case__\": 2}}, \"__page__\": null, \"__rerun_remap_job_id__\": null}",
"tool_version": "0.5.0",
"type": "tool",
"uuid": "b0485dad-0939-489d-8a9d-877d847dc29f",
"when": null,
"workflow_outputs": []
},
"2": {
"annotation": "",
"content_id": "param_value_from_file",
"errors": null,
"id": 2,
"input_connections": {
"input1": {
"id": 1,
"output_name": "list_output_txt"
}
},
"inputs": [],
"label": null,
"name": "Parse parameter value",
"outputs": [
{
"name": "integer_param",
"type": "expression.json"
}
],
"position": {
"left": 560,
"top": 0
},
"post_job_actions": {
"HideDatasetActiontext_param": {
"action_arguments": {},
"action_type": "HideDatasetAction",
"output_name": "text_param"
}
},
"tool_id": "param_value_from_file",
"tool_state": "{\"input1\": {\"__class__\": \"ConnectedValue\"}, \"param_type\": \"integer\", \"remove_newlines\": true, \"__page__\": null, \"__rerun_remap_job_id__\": null}",
"tool_version": "0.1.0",
"type": "tool",
"uuid": "7a0d475f-e575-4a37-a2e8-5f5756694b39",
"when": null,
"workflow_outputs": []
},
"3": {
"annotation": "",
"content_id": "toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_text_file_with_recurring_lines/1.1.0",
"errors": null,
"id": 3,
"input_connections": {
"token_set_0|repeat_select|times": {
"id": 2,
"output_name": "integer_param"
}
},
"inputs": [],
"label": null,
"name": "Create text file",
"outputs": [
{
"name": "outfile",
"type": "txt"
}
],
"position": {
"left": 840,
"top": 42
},
"post_job_actions": {},
"tool_id": "toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_text_file_with_recurring_lines/1.1.0",
"tool_shed_repository": {
"changeset_revision": "ddf54b12c295",
"name": "text_processing",
"owner": "bgruening",
"tool_shed": "toolshed.g2.bx.psu.edu"
},
"tool_state": "{\"token_set\": [{\"__index__\": 0, \"line\": \"test\", \"repeat_select\": {\"repeat_select_opts\": \"user\", \"__current_case__\": 0, \"times\": {\"__class__\": \"ConnectedValue\"}}}], \"__page__\": null, \"__rerun_remap_job_id__\": null}",
"tool_version": "1.1.0",
"type": "tool",
"uuid": "5be7215e-3c3d-4302-91dd-e5f020a2c16b",
"when": null,
"workflow_outputs": [
{
"label": "output",
"output_name": "outfile",
"uuid": "8b281401-fe43-4fd0-b835-532c3bba1b98"
}
]
}
},
"tags": [],
"uuid": "3d858ad4-cd53-468c-8e51-860b31356343",
"version": 3
}
2 changes: 2 additions & 0 deletions tests/data/wf_same_name_outputs_input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1
2
9 changes: 9 additions & 0 deletions tests/test_cmd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,3 +368,12 @@ def test_workflow_test_skipped_invocation(self):
test_command = self.append_profile_argument_if_needed(test_command)
test_command.append(test_artifact)
self._check_exit_code(test_command, exit_code=0)

@skip_if_environ("PLANEMO_SKIP_GALAXY_TESTS")
def test_workflow_with_identical_output_names(self):
with self._isolate():
test_artifact = os.path.join(TEST_DATA_DIR, "wf_same_name_outputs.ga")
test_command = self._test_command()
test_command = self.append_profile_argument_if_needed(test_command)
test_command.append(test_artifact)
self._check_exit_code(test_command, exit_code=0)

0 comments on commit 9daa9ba

Please sign in to comment.