Unverified Commit 44782a44 authored by Marius van den Beek's avatar Marius van den Beek Committed by GitHub
Browse files

Merge pull request #18023 from mvdbeek/fix_non_ready_collection_submission

[24.0] Raise appropriate exception if user forces a collection that is not populated with elements as input
parents 8f4968f0 a671090c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ class DatasetCollectionMatcher:
    def dataset_collection_match(self, dataset_collection):
        # If dataset collection not yet populated, cannot determine if it
        # would be a valid match for this parameter.
        if not dataset_collection.populated:
        if not dataset_collection.populated_optimized:
            return False

        valid = True
+2 −0
Original line number Diff line number Diff line
@@ -242,6 +242,8 @@ def __expand_collection_parameter(trans, input_key, incoming_val, collections_to
            subcollection_type = None
    hdc_id = trans.app.security.decode_id(encoded_hdc_id)
    hdc = trans.sa_session.get(HistoryDatasetCollectionAssociation, hdc_id)
    if not hdc.collection.populated_optimized:
        raise exceptions.ToolInputsNotReadyException("An input collection is not populated.")
    collections_to_match.add(input_key, hdc, subcollection_type=subcollection_type, linked=linked)
    if subcollection_type is not None:
        subcollection_elements = subcollections.split_dataset_collection_instance(hdc, subcollection_type)
+2 −3
Original line number Diff line number Diff line
@@ -1659,9 +1659,8 @@ class TestToolsApi(ApiTestCase, TestsTools):

    @skip_without_tool("cat1")
    def test_map_over_empty_collection(self, history_id):
        hdca_id = self.dataset_collection_populator.create_list_in_history(history_id, contents=[]).json()["outputs"][
            0
        ]["id"]
        response = self.dataset_collection_populator.create_list_in_history(history_id, contents=[], wait=True).json()
        hdca_id = response["output_collections"][0]["id"]
        inputs = {
            "input1": {"batch": True, "values": [{"src": "hdca", "id": hdca_id}]},
        }