20933: Copies collections reported by a-c-r
authorPeter Amstutz <peter.amstutz@curii.com>
Thu, 7 Sep 2023 20:43:45 +0000 (16:43 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Wed, 11 Oct 2023 21:13:56 +0000 (17:13 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

sdk/cwl/arvados_cwl/runner.py
sdk/python/arvados/commands/arv_copy.py

index 4d211d3ed6dd3e799cb8d5f319776ef84e4733e2..860f8a1b9a5f67966dca0041df937981aed9b330 100644 (file)
@@ -950,11 +950,16 @@ class Runner(Process):
 
 def print_keep_deps_visitor(references, doc_loader, tool):
     def collect_locators(obj):
-        loc = obj.get("location", "") or obj.get("http://arvados.org/cwl#dockerCollectionPDH", "")
+        loc = obj.get("location", "")
 
         g = arvados.util.keepuri_pattern.match(loc)
         if g and g[1] not in references:
             references.append(g[1])
+            return
+
+        loc = obj.get("http://arvados.org/cwl#dockerCollectionPDH", "") or obj.get("acrContainerImage")
+        if loc:
+            references.append(loc)
 
     sc_result = scandeps(tool["id"], tool,
                          set(),
@@ -963,6 +968,7 @@ def print_keep_deps_visitor(references, doc_loader, tool):
                          nestdirs=False)
 
     visit_class(sc_result, ("File", "Directory"), collect_locators)
+    visit_class(tool, ("DockerRequirement", "http://arvados.org/cwl#WorkflowRunnerResources"), collect_locators)
 
 
 def print_keep_deps(tool):
index d6af681ffb7a0c1b830b8345bfe34eb91d061ddc..ef0e031e60afe1c745056642b7585ff782207d3b 100755 (executable)
@@ -328,12 +328,11 @@ def copy_workflow(wf_uuid, src, dst, args):
                "ARVADOS_API_TOKEN": src.api_token,
                "PATH": os.environ["PATH"]}
         result = subprocess.run(["arvados-cwl-runner", "--quiet", "--print-keep-deps", "arvwf:"+wf_uuid],
-                                env=env)
-        print(result)
-        exit()
+                                capture_output=True, env=env)
+        locations = json.loads(result.stdout)
 
-        #if locations:
-        #        copy_collections(locations, src, dst, args)
+        if locations:
+            copy_collections(locations, src, dst, args)
 
     # copy the workflow itself
     del wf['uuid']