X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9432f0013765366507329649a5b8e1ea6345aaa2..c1761800f4c183439a32fb5e74b2f4a410911b66:/doc/sdk/python/cookbook.html.textile.liquid diff --git a/doc/sdk/python/cookbook.html.textile.liquid b/doc/sdk/python/cookbook.html.textile.liquid index 3aa01bbb56..eda6563d7a 100644 --- a/doc/sdk/python/cookbook.html.textile.liquid +++ b/doc/sdk/python/cookbook.html.textile.liquid @@ -237,13 +237,13 @@ with c.open(filename, "rb") as reader: print("Finished downloading %s" % filename) {% endcodeblock %} -h2. Copy files from a collection a new collection +h2. Copy files from a collection to a new collection {% codeblock as python %} import arvados.collection -source_collection = "x1u39-4zz18-krzg64ufvehgitl" -target_project = "x1u39-j7d0g-67q94einb8ptznm" +source_collection = "zzzzz-4zz18-zzzzzzzzzzzzzzz" +target_project = "zzzzz-j7d0g-zzzzzzzzzzzzzzz" target_name = "Files copied from source_collection" files_to_copy = ["folder1/sample1/sample1_R1.fastq", "folder1/sample2/sample2_R1.fastq"] @@ -258,13 +258,13 @@ target.save_new(name=target_name, owner_uuid=target_project) print("Created collection %s" % target.manifest_locator()) {% endcodeblock %} -h2. Copy files from a collection another collection +h2. Copy files from a collection to another collection {% codeblock as python %} import arvados.collection -source_collection = "x1u39-4zz18-krzg64ufvehgitl" -target_collection = "x1u39-4zz18-67q94einb8ptznm" +source_collection = "zzzzz-4zz18-zzzzzzzzzzzzzzz" +target_collection = "zzzzz-4zz18-aaaaaaaaaaaaaaa" files_to_copy = ["folder1/sample1/sample1_R1.fastq", "folder1/sample2/sample2_R1.fastq"] @@ -277,6 +277,16 @@ for f in files_to_copy: target.save() {% endcodeblock %} +h2. Delete a file from an existing collection + +{% codeblock as python %} +import arvados + +c = arvados.collection.Collection("zzzzz-4zz18-zzzzzzzzzzzzzzz") +c.remove("file2.txt") +c.save() +{% endcodeblock %} + h2. Listing records with paging Use the @arvados.util.keyset_list_all@ helper method to iterate over all the records matching an optional filter. This method handles paging internally and returns results incrementally using a Python iterator. The first parameter of the method takes a @list@ method of an Arvados resource (@collections@, @container_requests@, etc).