1616 post_metadata_definition ,
1717)
1818
19+ from scripts .migration .dataset_collection_json import get_dataset_collections_map
20+
21+ DATASET_COLLECTIONS_MAP = get_dataset_collections_map ()
22+
1923# Configuration and Constants
2024DEFAULT_PASSWORD = "Password123&"
2125
@@ -725,10 +729,12 @@ def build_collection_metadata_for_v1_dataset(dataset_id, user_v1, headers):
725729# TODO test this method
726730def build_collection_space_metadata_for_v1_dataset (dataset , user_v1 , headers ):
727731 dataset_id = dataset ["id" ]
728- # TODO this is too slow we need a way to sort through collection hierarchy better
729- dataset_collections = get_clowder_v1_dataset_collections (
730- headers = headers , user_v1 = user_v1 , dataset_id = dataset_id
731- )
732+ dataset_collections = []
733+ if dataset_id in DATASET_COLLECTIONS_MAP :
734+ dataset_collections_ids = DATASET_COLLECTIONS_MAP [dataset_id ]
735+ for col_id in dataset_collections_ids :
736+ collection = get_clowder_v1_collection (col_id , headers = headers )
737+ dataset_collections .append (collection )
732738 dataset_spaces = dataset ["spaces" ]
733739 space_entries = []
734740 for space_id in dataset_spaces :
@@ -739,7 +745,8 @@ def build_collection_space_metadata_for_v1_dataset(dataset, user_v1, headers):
739745 space_entry = {
740746 "id" : space ["id" ],
741747 "name" : space ["name" ],
742- "creator" : space ["creator" ],
748+ # TODO this is not part of the json
749+ # "creator": space["creator"],
743750 }
744751 space_entries .append (space_entry )
745752 except Exception as e :
0 commit comments