From 377bffd3aedd2a98c40a16b9ebbff95902cb19dc Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Fri, 8 Mar 2019 16:59:05 +0100 Subject: [PATCH] Fix ChangeDatatypeAction for collections --- lib/galaxy/jobs/actions/post.py | 3 ++- test/api/test_workflows.py | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/jobs/actions/post.py b/lib/galaxy/jobs/actions/post.py index 02e9b527897..d33aba36280 100644 --- a/lib/galaxy/jobs/actions/post.py +++ b/lib/galaxy/jobs/actions/post.py @@ -77,7 +77,8 @@ class ChangeDatatypeAction(DefaultJobAction): for dataset_collection_assoc in job.output_dataset_collection_instances: if action.output_name == '' or dataset_collection_assoc.name == action.output_name: for dataset_instance in dataset_collection_assoc.dataset_collection_instance.dataset_instances: - app.datatypes_registry.change_datatype(dataset_instance, action.action_arguments['newtype']) + if dataset_instance: + app.datatypes_registry.change_datatype(dataset_instance, action.action_arguments['newtype']) @classmethod def get_short_str(cls, pja): diff --git a/test/api/test_workflows.py b/test/api/test_workflows.py index 7bfdb9c8b8d..417c6d6e9b9 100644 --- a/test/api/test_workflows.py +++ b/test/api/test_workflows.py @@ -1612,6 +1612,32 @@ input1: """, history_id=history_id, wait=True) self.assertEqual("0\n", self.dataset_populator.get_history_dataset_content(history_id)) + @skip_without_tool("random_lines1") + def test_change_datatype_collection_map_over(self): + with self.dataset_populator.test_history() as history_id: + jobs_summary = self._run_jobs(""" +class: GalaxyWorkflow +inputs: + text_input1: collection +steps: + map_over: + tool_id: random_lines1 + in: + input: text_input1 + outputs: + out_file1: + change_datatype: csv +""", test_data=""" +text_input1: + type: "list:paired" +""", history_id=history_id) + hdca = self.dataset_populator.get_history_collection_details(history_id=jobs_summary.history_id, hid=4) + assert hdca['collection_type'] == 'list:paired' + assert len(hdca['elements'][0]['object']["elements"]) == 2 + forward, reverse = hdca['elements'][0]['object']["elements"] + assert forward['object']['file_ext'] == 'csv' + assert reverse['object']['file_ext'] == 'csv' + @skip_without_tool("collection_type_source_map_over") def test_mapping_and_subcollection_mapping(self): with self.dataset_populator.test_history() as history_id: