X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/d1a7f9691ff2b9d77106f953c714b1455b228c64..3737e05681b6cfb22ea0af0da08598e458da16f0:/sdk/cwl/arvados_cwl/runner.py diff --git a/sdk/cwl/arvados_cwl/runner.py b/sdk/cwl/arvados_cwl/runner.py index 19ce39375e..c55e976924 100644 --- a/sdk/cwl/arvados_cwl/runner.py +++ b/sdk/cwl/arvados_cwl/runner.py @@ -46,11 +46,16 @@ def trim_anonymous_location(obj): if obj.get("location", "").startswith("_:"): del obj["location"] +def remove_redundant_fields(obj): + for field in ("path", "nameext", "nameroot", "dirname"): + if field in obj: + del obj[field] + 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 +123,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 +166,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) @@ -291,6 +293,12 @@ class Runner(object): self.tool = tool self.job_order = job_order self.running = False + if enable_reuse: + # If reuse is permitted by command line arguments but + # disabled by the workflow itself, disable it. + reuse_req, _ = get_feature(self.tool, "http://arvados.org/cwl#ReuseRequirement") + if reuse_req: + enable_reuse = reuse_req["enableReuse"] self.enable_reuse = enable_reuse self.uuid = None self.final_output = None