Bug #20637 ยป makecollections.py
1 |
import arvados |
---|---|
2 |
import arvados.collection |
3 |
|
4 |
# Need to create 5000 collections each one containing a file with different contents
|
5 |
|
6 |
api = arvados.api() |
7 |
|
8 |
project_uuid = api.groups().create(body={"group": {"name": "many collections", "group_class": "project"}}).execute()["uuid"] |
9 |
|
10 |
for r in range(0, 5000): |
11 |
coll = arvados.collection.Collection(api_client=api) |
12 |
with coll.open("the_test_file", "wt") as f: |
13 |
f.write(("%s_" % r) * 2050) |
14 |
|
15 |
coll.save_new("collection %s" % r, owner_uuid=project_uuid) |
16 |
|
17 |
with coll.open("the_test_file", "at") as f: |
18 |
f.write(("%s_" % (r+1)) * 2050) |
19 |
|
20 |
coll.save() |
21 |
|
22 |
with coll.open("the_test_file", "at") as f: |
23 |
f.write(("%s_" % (r+2)) * 2050) |
24 |
|
25 |
coll.save() |
26 |
|
27 |
with coll.open("the_test_file", "at") as f: |
28 |
f.write(("%s_" % (r+3)) * 2050) |
29 |
|
30 |
coll.save() |