Skip to content

Commit 1e3edb0

Browse files
author
CodaLab
committed
update migration script
1 parent a42a199 commit 1e3edb0

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

scripts/migrate-disk-to-blob.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
"""
44
docker exec -ti codalab_rest-server_1 bash
55
cd /data/codalab0/migration
6-
python codalab-worksheets/scripts/migrate-disk-to-blob.py
6+
time python codalab-worksheets/scripts/migrate-disk-to-blob.py -p 4 -i 0 -TUVC
7+
time python codalab-worksheets/scripts/migrate-disk-to-blob.py -p 4 -i 1 -TUVC
8+
time python codalab-worksheets/scripts/migrate-disk-to-blob.py -p 4 -i 2 -TUVC
9+
time python codalab-worksheets/scripts/migrate-disk-to-blob.py -p 4 -i 3 -TUVC
10+
11+
Took ~1 week.
712
"""
813

914
import multiprocessing
@@ -164,7 +169,10 @@ def write_migration_states(self):
164169

165170
def get_bundle_uuids(self, max_bundles):
166171
bundle_uuids = self.model.get_all_bundle_uuids(max_results=1e9)
167-
return sorted(list(set(bundle_uuids)))[:max_bundles]
172+
bundle_uuids = sorted(list(set(bundle_uuids)))
173+
if max_bundles:
174+
bundle_uuids = bundle_uuids[:max_bundles]
175+
return bundle_uuids
168176

169177
def is_linked_bundle(self, bundle_uuid):
170178
bundle_link_url = self.model.get_bundle_metadata(
@@ -514,7 +522,7 @@ def migrate_bundles(self, bundle_uuids):
514522
for i, uuid in enumerate(bundle_uuids):
515523
self.migrate_bundle(f"{i}/{total}", uuid)
516524
now = time.time()
517-
if i == len(bundle_uuids) - 1 or now - self.last_write_time > 60: # 1 minute
525+
if i == len(bundle_uuids) - 1 or now - self.last_write_time > 20: # every N seconds
518526
self.log_times()
519527
self.write_migration_states()
520528
self.last_write_time = now
@@ -561,7 +569,7 @@ def run_job(target_store_name, upload, change_db, verify, delete_disk, delete_ta
561569

562570
if __name__ == '__main__':
563571
parser = argparse.ArgumentParser()
564-
parser.add_argument('-m', '--max-bundles', type=int, help='Maximum number of bundles to migrate', default=1e9)
572+
parser.add_argument('-m', '--max-bundles', type=int, help='Maximum number of bundles to migrate')
565573
parser.add_argument('-u', '--bundle-uuids', type=str, nargs='*', default=None, help='List of bundle UUIDs to migrate.')
566574
parser.add_argument('-t', '--target-store-name', type=str, help='The destination bundle store name', default="blob-prod")
567575
parser.add_argument('-U', '--upload', help='Upload', action='store_true')

0 commit comments

Comments
 (0)