[ARVADOS] updated: 52905eb46fbf2fbeb3d6697c90007b13d8382042
Git user
git at public.curoverse.com
Mon Sep 11 10:59:51 EDT 2017
Summary of changes:
doc/sdk/python/cookbook.html.textile.liquid | 83 ++++++++++++++++++++++++++++-
1 file changed, 82 insertions(+), 1 deletion(-)
via 52905eb46fbf2fbeb3d6697c90007b13d8382042 (commit)
via d62a499c30f41c0bed68c6e9978910ca64b82dd1 (commit)
from efd0ed5fa583d09f7d272ecc9461ec1684cf0cb4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 52905eb46fbf2fbeb3d6697c90007b13d8382042
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Mon Sep 11 10:59:02 2017 -0400
10349: Add snippts for listing inputs/outputs of containers, failed child
requests, list logs of request.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/doc/sdk/python/cookbook.html.textile.liquid b/doc/sdk/python/cookbook.html.textile.liquid
index 7ce547a..df8181f 100644
--- a/doc/sdk/python/cookbook.html.textile.liquid
+++ b/doc/sdk/python/cookbook.html.textile.liquid
@@ -62,6 +62,75 @@ collection = arvados.collection.CollectionReader(container_request["output_uuid"
print(collection.open("cwl.output.json").read())
</code>
+h2. List input of child requests
+
+<code>
+import arvados
+api = arvados.api()
+parent_request_uuid = "qr1hi-xvhdp-zzzzzzzzzzzzzzz"
+namefilter = "bwa%"
+container_request = arvados.api().container_requests().get(uuid=parent_request_uuid).execute()
+parent_container_uuid = container_request["container_uuid"]
+child_requests = arvados.api().container_requests().list(filters=[
+ ["requesting_container_uuid", "=", parent_container_uuid],
+ ["name", "like", namefilter]]).execute()
+for c in child_requests["items"]:
+ print("%s" % c["name"])
+ for m in c["mounts"].values():
+ if "portable_data_hash" in m:
+ print(" %s" % m["portable_data_hash"])
+</code>
+
+h2. List output of child requests
+
+<code>
+import arvados
+api = arvados.api()
+parent_request_uuid = "qr1hi-xvhdp-61y7cjymnhyp7yu"
+namefilter = "bwa%"
+container_request = arvados.api().container_requests().get(uuid=parent_request_uuid).execute()
+parent_container_uuid = container_request["container_uuid"]
+child_requests = arvados.api().container_requests().list(filters=[
+ ["requesting_container_uuid", "=", parent_container_uuid],
+ ["name", "like", namefilter]]).execute()
+output_uuids = [c["output_uuid"] for c in child_requests["items"]]
+collections = arvados.api().collections().list(filters=[["uuid", "in", output_uuids]]).execute()
+uuid_to_pdh = {c["uuid"]: c["portable_data_hash"] for c in collections["items"]}
+for c in child_requests["items"]:
+ print("%s -> %s" % (c["name"], uuid_to_pdh[c["output_uuid"]]))
+</code>
+
+h2. List failed child requests
+
+<code>
+import arvados
+api = arvados.api()
+parent_request_uuid = "qr1hi-xvhdp-3d8f1zatx1xio36"
+container_request = arvados.api().container_requests().get(uuid=parent_request_uuid).execute()
+parent_container_uuid = container_request["container_uuid"]
+child_requests = arvados.api().container_requests().list(filters=[
+ ["requesting_container_uuid", "=", parent_container_uuid]], limit=1000).execute()
+child_containers = {c["container_uuid"]: c for c in child_requests["items"]}
+cancelled_child_containers = arvados.api().containers().list(filters=[
+ ["exit_code", "!=", "0"],
+ ["uuid", "in", child_containers.keys()]], limit=1000).execute()
+for c in cancelled_child_containers["items"]:
+ print("%s (%s)" % (child_containers[c["uuid"]]["name"], child_containers[c["uuid"]]["uuid"]))
+</code>
+
+h2. Get log of a child request
+
+<code>
+import arvados
+import arvados.collection
+api = arvados.api()
+container_request_uuid = "qr1hi-xvhdp-3d8f1zatx1xio36"
+container_request = arvados.api().container_requests().get(uuid=container_request_uuid).execute()
+collection = arvados.collection.CollectionReader(container_request["log_uuid"])
+for c in collection:
+ print(collection.open(c).read())
+</code>
+
h2. Create a collection sharing link
<code>
@@ -75,5 +144,3 @@ token = api.api_client_authorizations().create(body={"api_client_authorization":
"GET /arvados/v1/keep_services/accessible"]}}).execute()
print("%s/c=%s/t=%s/_/" % (download, collection_uuid, token["api_token"]))
</code>
-
-h2. Run a CWL workflow from a workflow record
commit d62a499c30f41c0bed68c6e9978910ca64b82dd1
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Wed Aug 30 17:33:13 2017 -0400
10349: Add "Create a collection sharing link"
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/doc/sdk/python/cookbook.html.textile.liquid b/doc/sdk/python/cookbook.html.textile.liquid
index 2adb986..7ce547a 100644
--- a/doc/sdk/python/cookbook.html.textile.liquid
+++ b/doc/sdk/python/cookbook.html.textile.liquid
@@ -62,4 +62,18 @@ collection = arvados.collection.CollectionReader(container_request["output_uuid"
print(collection.open("cwl.output.json").read())
</code>
+h2. Create a collection sharing link
+
+<code>
+import arvados
+api = arvados.api()
+download="https://your.download.server"
+collection_uuid="your-4zz18-collectionuuid"
+token = api.api_client_authorizations().create(body={"api_client_authorization":{"scopes": [
+ "GET /arvados/v1/collections/%s" % collection_uuid,
+ "GET /arvados/v1/collections/%s/" % collection_uuid,
+ "GET /arvados/v1/keep_services/accessible"]}}).execute()
+print("%s/c=%s/t=%s/_/" % (download, collection_uuid, token["api_token"]))
+</code>
+
h2. Run a CWL workflow from a workflow record
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list