Skip to content

Commit 34c868b

Browse files
committed
more readme instructions
refactoring to make it clear when a v1 dataset is a v2 dataset or when a v1 collection is a v2 dataset
1 parent 1f3e5ed commit 34c868b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

scripts/migration/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ This file can be used to limit what gets migrated by space or user.
1313
2. add your values to the .env and the config.toml file
1414
3. run the script `get_collections.py` this gets all collections from the v1 instance
1515
4. run the script `get_collection_datasets.py` this gets all the datasets in the collections
16+
5. run the script `dataset_collection_json.py` this creates a json file that shows which datasets are in a collection, and which are not. The datasets that are in a collection will be migrated to folders, while theo nes that are not will be migrated to datasets
1617
5. Now you are ready to run `migrate.py` - it uses the data from the previous scripts to place datasets into the right collections
1718

scripts/migration/migrate.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ def process_collection_descendants(
284284
dataset, v2_dataset_id, new_folder["id"], headers_v1, base_headers_v2
285285
)
286286
# TODO add dataset metadata to the folder
287+
print('done with collection descendants')
287288

288289

289290
def get_v1_dataset_folders(dataset, headers_v1, headers_v2, parent_type, parent_id):
@@ -340,7 +341,7 @@ def process_dataset_files_and_folders(
340341
print(f"Got dataset files")
341342

342343

343-
def create_v2_dataset_from_collection(
344+
def create_v2_dataset_from_v1_collection(
344345
collection, user_v1, headers_v1, headers_v2, base_headers_v2
345346
):
346347
# create the dataset
@@ -590,7 +591,7 @@ def add_dataset_license(v1_license, headers):
590591
return license_id
591592

592593

593-
def create_v2_dataset(dataset, headers):
594+
def create_v2_dataset_from_v1_dataset(dataset, headers):
594595
"""Create a dataset in Clowder v2."""
595596
# TODO: GET correct license
596597
print("Creating dataset license in Clowder v2.")
@@ -1168,7 +1169,7 @@ def process_user_and_resources_collections(
11681169

11691170
# create datasets from the top level collections
11701171
for top_level_col in migrate_top_level_collections:
1171-
dataset_v2 = create_v2_dataset_from_collection(
1172+
dataset_v2 = create_v2_dataset_from_v1_collection(
11721173
collection=top_level_col,
11731174
user_v1=user_v1,
11741175
headers_v1=clowder_headers_v1,
@@ -1215,7 +1216,7 @@ def process_user_and_resources_collections(
12151216
)
12161217
MIGRATE_DATASET = False
12171218
if MIGRATE_DATASET:
1218-
dataset_v2_id = create_v2_dataset(dataset, user_headers_v2)
1219+
dataset_v2_id = create_v2_dataset_from_v1_dataset(dataset, user_headers_v2)
12191220
DATASET_MAP[dataset["id"]] = dataset_v2_id
12201221
#
12211222
add_dataset_metadata(
@@ -1337,7 +1338,7 @@ def process_user_and_resources(user_v1, USER_MAP, DATASET_MAP):
13371338
)
13381339
MIGRATE_DATASET = False
13391340
if MIGRATE_DATASET:
1340-
dataset_v2_id = create_v2_dataset(dataset, user_headers_v2)
1341+
dataset_v2_id = create_v2_dataset_from_v1_dataset(dataset, user_headers_v2)
13411342
DATASET_MAP[dataset["id"]] = dataset_v2_id
13421343
add_dataset_metadata(
13431344
dataset, dataset_v2_id, base_headers_v1, user_headers_v2

0 commit comments

Comments
 (0)