Project

General

Profile

Bug #20637 ยป makecollections.py

Peter Amstutz, 06/16/2023 05:44 PM

 
import arvados
import arvados.collection

# Need to create 5000 collections each one containing a file with different contents

api = arvados.api()

project_uuid = api.groups().create(body={"group": {"name": "many collections", "group_class": "project"}}).execute()["uuid"]

for r in range(0, 5000):
coll = arvados.collection.Collection(api_client=api)
with coll.open("the_test_file", "wt") as f:
f.write(("%s_" % r) * 2050)

coll.save_new("collection %s" % r, owner_uuid=project_uuid)

with coll.open("the_test_file", "at") as f:
f.write(("%s_" % (r+1)) * 2050)

coll.save()

with coll.open("the_test_file", "at") as f:
f.write(("%s_" % (r+2)) * 2050)

coll.save()

with coll.open("the_test_file", "at") as f:
f.write(("%s_" % (r+3)) * 2050)

coll.save()
    (1-1/1)