Merge branch '12093-cwl-project-uuid' closes #12093
[arvados.git] / sdk / cwl / arvados_cwl / runner.py
index 19ce39375e62b99cd1bfee2e36e006604d2093c5..bb4fac2ae9541a55872ff6fd371b380659a0f15e 100644 (file)
@@ -50,7 +50,7 @@ def find_defaults(d, op):
     if isinstance(d, list):
         for i in d:
             find_defaults(i, op)
-    if isinstance(d, dict):
+    elif isinstance(d, dict):
         if "default" in d:
             op(d)
         else:
@@ -118,14 +118,9 @@ def upload_dependencies(arvrunner, name, document_loader,
             if "location" not in f and "path" in f:
                 f["location"] = f["path"]
                 del f["path"]
-            if not arvrunner.fs_access.exists(f["location"]):
+            if "location" in f and not arvrunner.fs_access.exists(f["location"]):
                 # Remove from sc
-                i = 0
-                while i < len(sc):
-                    if sc[i]["location"] == f["location"]:
-                        del sc[i]
-                    else:
-                        i += 1
+                sc[:] = [x for x in sc if x["location"] != f["location"]]
                 # Delete "default" from workflowobj
                 remove[0] = True
         visit_class(obj["default"], ("File", "Directory"), add_default)
@@ -166,6 +161,8 @@ def upload_docker(arvrunner, tool):
                 raise SourceLine(docker_req, "dockerOutputDirectory", UnsupportedRequirement).makeError(
                     "Option 'dockerOutputDirectory' of DockerRequirement not supported.")
             arv_docker_get_image(arvrunner.api, docker_req, True, arvrunner.project_uuid)
+        else:
+            arv_docker_get_image(arvrunner.api, {"dockerPull": "arvados/jobs"}, True, arvrunner.project_uuid)
     elif isinstance(tool, cwltool.workflow.Workflow):
         for s in tool.steps:
             upload_docker(arvrunner, s.embedded_tool)