Unverified Commit bbe25047 authored by mvdbeek's avatar mvdbeek
Browse files

Fix skipping simple mapped over steps in conditional subworkflow steps

parent 06a43944
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -94,12 +94,19 @@ class Tree(BaseTree):
            def get_element(collection):
                return collection[index]  # noqa: B023

            when_value = None
            if self.when_values:
                if len(self.when_values) == 1:
                    when_value = self.when_values[0]
                else:
                    when_value = self.when_values[index]

            if substructure.is_leaf:
                yield dict_map(get_element, collection_dict), self.when_values[index] if self.when_values else None
                yield dict_map(get_element, collection_dict), when_value
            else:
                sub_collections = dict_map(lambda collection: get_element(collection).child_collection, collection_dict)
                for element, _when_value in substructure._walk_collections(sub_collections):
                    yield element, self.when_values[index] if self.when_values else None
                    yield element, when_value

    @property
    def is_leaf(self):
+9 −2
Original line number Diff line number Diff line
@@ -512,8 +512,15 @@ class WorkflowModule:
        collections_to_match = self._find_collections_to_match(progress, step, all_inputs)
        # Have implicit collections...
        collection_info = self.trans.app.dataset_collection_manager.match_collections(collections_to_match)
        if collection_info and progress.subworkflow_collection_info:
        if collection_info:
            if progress.subworkflow_collection_info:
                # We've mapped over a subworkflow. Slices of the invocation might be conditional
                # and progress.subworkflow_collection_info.when_values holds the appropriate when_values
                collection_info.when_values = progress.subworkflow_collection_info.when_values
            else:
                # The invocation is not mapped over, but it might still be conditional.
                # Multiplication and linking should be handled by slice_collection()
                collection_info.when_values = progress.when_values
        return collection_info or progress.subworkflow_collection_info

    def _find_collections_to_match(self, progress, step, all_inputs):