def copy_bucket_to_local()

in dataflux_pytorch/benchmark/checkpointing/multinode/train.py [0:0]


def copy_bucket_to_local(bucket_name, local_dir):
    storage_client = storage.Client()
    bucket = storage_client.bucket(bucket_name)

    blobs = bucket.list_blobs()

    for blob in blobs:
        local_path = os.path.join(local_dir, blob.name)
        os.makedirs(os.path.dirname(local_path), exist_ok=True)
        blob.download_to_filename(local_path)