diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index a548fcfc1d7..74aad284ce6 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -3521,14 +3521,13 @@ class DatasetCollection(Dictifiable, UsesAnnotations, RepresentById): self.populated_state = DatasetCollection.populated_states.FAILED self.populated_state_message = message - def finalize(self): + def finalize(self, collection_type_description): # All jobs have written out their elements - everything should be populated # but might not be - check that second case! (TODO) self.mark_as_populated() - if self.has_subcollections: - # THIS IS WRONG - SHOULD ONLY BE TO THE DEPTH OF THE MAP OVER. + if self.has_subcollections and collection_type_description.has_subcollections(): for element in self.elements: - element.child_collection.finalize() + element.child_collection.finalize(collection_type_description.child_collection_type_description()) @property def dataset_instances(self): diff --git a/lib/galaxy/tools/execute.py b/lib/galaxy/tools/execute.py index 6f9b6a1ec67..16012e25e49 100644 --- a/lib/galaxy/tools/execute.py +++ b/lib/galaxy/tools/execute.py @@ -314,7 +314,9 @@ class ExecutionTracker(object): implicit_collection_jobs = implicit_collection.implicit_collection_jobs implicit_collection_jobs.populated_state = "ok" trans.sa_session.add(implicit_collection_jobs) - implicit_collection.collection.finalize() + implicit_collection.collection.finalize( + collection_type_description=self.collection_info.structure.collection_type_description + ) trans.sa_session.add(implicit_collection.collection) trans.sa_session.flush() diff --git a/lib/galaxy/tools/wrappers.py b/lib/galaxy/tools/wrappers.py index 6f10b668031..79f3883c70c 100644 --- a/lib/galaxy/tools/wrappers.py +++ b/lib/galaxy/tools/wrappers.py @@ -108,7 +108,7 @@ class InputValueWrapper(ToolParameterValueWrapper): return getattr(self.value, key) def __int__(self): - return int(str(self)) + return int(float(self)) def __float__(self): return float(str(self)) diff --git a/test/api/test_workflows.py b/test/api/test_workflows.py index ca77ace8ff0..08c7a9f29e0 100644 --- a/test/api/test_workflows.py +++ b/test/api/test_workflows.py @@ -1165,6 +1165,41 @@ steps: assert len(identifiers) == 6 assert "oe1-ie1" in identifiers + @skip_without_tool("collection_paired_test") + def test_workflow_flatten_with_mapped_over_execution(self): + with self.dataset_populator.test_history() as history_id: + self._run_jobs(r""" +class: GalaxyWorkflow +inputs: + input_fastqs: collection +steps: + split_up: + tool_id: collection_split_on_column + in: + input1: input_fastqs + flatten: + tool_id: '__FLATTEN__' + in: + input: split_up/split_output + join_identifier: '-' +test_data: + input_fastqs: + type: list + elements: + - identifier: samp1 + content: "0\n1" +""", history_id=history_id) + history = self._get('histories/%s/contents' % history_id).json() + flattened_collection = history[-1] + assert flattened_collection['history_content_type'] == 'dataset_collection' + assert flattened_collection['collection_type'] == 'list' + assert flattened_collection['element_count'] == 2 + nested_collection = self.dataset_populator.get_history_collection_details(history_id, hid=3) + assert nested_collection['collection_type'] == 'list:list' + assert nested_collection['element_count'] == 1 + assert nested_collection['elements'][0]['object']['populated'] + assert nested_collection['elements'][0]['object']['element_count'] == 2 + @skip_without_tool("__APPLY_RULES__") def test_workflow_run_apply_rules(self): with self.dataset_populator.test_history() as history_id: diff --git a/test/functional/tools/cheetah_casting.xml b/test/functional/tools/cheetah_casting.xml index d12bb6569e8..ab9c7606158 100644 --- a/test/functional/tools/cheetah_casting.xml +++ b/test/functional/tools/cheetah_casting.xml @@ -1,9 +1,11 @@ #set $int_val_inc = int($inttest) + 1 + #set $int_flot_val_inc = int($floattest) + 1 #set $float_val_inc = float($floattest) + 1 - echo $int_val_inc >> $out_file1; - echo $float_val_inc >> $out_file1; + echo $int_val_inc >> '$out_file1'; + echo $int_flot_val_inc >> '$out_file1'; + echo $float_val_inc >> '$out_file1'; @@ -19,6 +21,7 @@ +