[ARVADOS] updated: 097953b998eb4138285079dd3f58445fe4099fbb

Git user git at public.curoverse.com
Tue Jan 10 17:03:06 EST 2017


Summary of changes:
 doc/user/topics/arv-copy.html.textile.liquid | 23 ++++++++++++++++++
 sdk/python/arvados/commands/arv_copy.py      | 35 +++++++++++++++++++++-------
 2 files changed, 49 insertions(+), 9 deletions(-)

       via  097953b998eb4138285079dd3f58445fe4099fbb (commit)
      from  278ab6f51df6163e49eedd16afc8bfa907522ce8 (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 097953b998eb4138285079dd3f58445fe4099fbb
Author: radhika <radhika at curoverse.com>
Date:   Wed Jan 4 07:50:20 2017 -0500

    10110: also copy any docker images during arv-copy of a workflow and update documentation.

diff --git a/doc/user/topics/arv-copy.html.textile.liquid b/doc/user/topics/arv-copy.html.textile.liquid
index 223f2fe..76ff1c1 100644
--- a/doc/user/topics/arv-copy.html.textile.liquid
+++ b/doc/user/topics/arv-copy.html.textile.liquid
@@ -81,3 +81,26 @@ For example, we can copy the same object using this tag.
 <pre><code>~$ <span class="userinput">arv-copy --src qr1hi --dst dst_cluster --dst-git-repo $USER/tutorial --no-recursive qr1hi-p5p6p-9pkaxt6qjnkxhhu</span>
 </code></pre>
 </notextile>
+
+h3. How to copy a workflow
+
+We will use the uuid @zzzzz-7fd4e-sampleworkflow1@ as an example workflow.
+
+<notextile>
+<pre><code>~$ <span class="userinput">arv-copy --src zzzzz --dst dst_cluster --dst-git-repo $USER/tutorial zzzzz-7fd4e-sampleworkflow1</span>
+zzzzz-4zz18-jidprdejysravcr: 1143M / 1143M 100.0% 
+2017-01-04 04:11:58 arvados.arv-copy[5906] INFO:
+2017-01-04 04:11:58 arvados.arv-copy[5906] INFO: Success: created copy with uuid dst_cluster-7fd4e-ojtgpne594ubkt7
+</code></pre>
+</notextile>
+
+The name, description, and workflow definition from the original workflow will be used for the destination copy. In addition, any *locations* and *docker images* found in the src workflow definition will also be copied to the destination recursively.
+
+If you would like to copy the object without dependencies, you can use the @--no-recursive@ flag.
+
+For example, we can copy the same object non-recursively using the following:
+
+<notextile>
+<pre><code>~$ <span class="userinput">arv-copy --src zzzzz --dst dst_cluster --dst-git-repo $USER/tutorial --no-recursive zzzzz-7fd4e-sampleworkflow1</span>
+</code></pre>
+</notextile>
diff --git a/sdk/python/arvados/commands/arv_copy.py b/sdk/python/arvados/commands/arv_copy.py
index 71820b3..1af6aa7 100755
--- a/sdk/python/arvados/commands/arv_copy.py
+++ b/sdk/python/arvados/commands/arv_copy.py
@@ -425,33 +425,50 @@ def copy_workflow(wf_uuid, src, dst, args):
     # fetch the workflow from the source instance
     wf = src.workflows().get(uuid=wf_uuid).execute(num_retries=args.retries)
 
+    # copy collections and docker images
     if args.recursive:
         wf_def = yaml.safe_load(wf["definition"])
         if wf_def is not None:
-            colls = []
+            locations = []
+            docker_images = {}
             graph = wf_def.get('$graph', None)
             if graph is not None:
-                workflow_collections(graph, colls)
+                workflow_collections(graph, locations, docker_images)
             else:
-                workflow_collections(wf_def, colls)
-            copy_collections(colls, src, dst, args)
+                workflow_collections(graph, locations, docker_images)
 
+            if locations:
+                copy_collections(locations, src, dst, args)
+
+            for image in docker_images:
+                copy_docker_image(image, docker_images[image], src, dst, args)
+
+    # copy the workflow itself
     del wf['uuid']
     wf['owner_uuid'] = args.project_uuid
-
     return dst.workflows().create(body=wf).execute(num_retries=args.retries)
 
-def workflow_collections(obj, colls):
+def workflow_collections(obj, locations, docker_images):
     if isinstance(obj, dict):
         loc = obj.get('location', None)
         if loc is not None:
             if loc.startswith("keep:"):
-                colls.append(loc[5:])
+                locations.append(loc[5:])
+
+        docker_image = obj.get('dockerImageId', None)
+        if docker_image is None:
+            docker_image = obj.get('dockerPull', None)
+        if docker_image is not None:
+            ds = docker_image.split(":", 1)
+            tag = ds[1] if len(ds)==2 else 'latest'
+            docker_images[ds[0]] = tag
+
         for x in obj:
-            workflow_collections(obj[x], colls)
+            workflow_collections(obj[x], locations, docker_images)
+
     if isinstance(obj, list):
         for x in obj:
-            workflow_collections(x, colls)
+            workflow_collections(x, locations, docker_images)
 
 # copy_collections(obj, src, dst, args)
 #

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list