X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b1b7794d253c653a370200c2b33d477d3f7f231e..9b0654adfffaac018395de29f6e441b843d46e85:/sdk/cwl/arvados_cwl/runner.py diff --git a/sdk/cwl/arvados_cwl/runner.py b/sdk/cwl/arvados_cwl/runner.py index ba41d7d97e..2d13e6640b 100644 --- a/sdk/cwl/arvados_cwl/runner.py +++ b/sdk/cwl/arvados_cwl/runner.py @@ -110,6 +110,9 @@ def upload_docker(arvrunner, tool): if isinstance(tool, CommandLineTool): (docker_req, docker_is_req) = get_feature(tool, "DockerRequirement") if docker_req: + if docker_req.get("dockerOutputDirectory"): + # TODO: can be supported by containers API, but not jobs API. + raise UnsupportedRequirement("Option 'dockerOutputDirectory' of DockerRequirement not supported.") arv_docker_get_image(arvrunner.api, docker_req, True, arvrunner.project_uuid) elif isinstance(tool, cwltool.workflow.Workflow): for s in tool.steps: @@ -158,7 +161,9 @@ def arvados_jobs_image(arvrunner): return img class Runner(object): - def __init__(self, runner, tool, job_order, enable_reuse, output_name): + def __init__(self, runner, tool, job_order, enable_reuse, + output_name, output_tags, submit_runner_ram=0, + name=None): self.arvrunner = runner self.tool = tool self.job_order = job_order @@ -167,12 +172,23 @@ class Runner(object): self.uuid = None self.final_output = None self.output_name = output_name + self.output_tags = output_tags + self.name = name + + if submit_runner_ram: + self.submit_runner_ram = submit_runner_ram + else: + self.submit_runner_ram = 1024 + + if self.submit_runner_ram <= 0: + raise Exception("Value of --submit-runner-ram must be greater than zero") def update_pipeline_component(self, record): pass def arvados_job_spec(self, *args, **kwargs): - self.name = os.path.basename(self.tool.tool["id"]) + if self.name is None: + self.name = os.path.basename(self.tool.tool["id"]) workflowmapper = upload_instance(self.arvrunner, self.name, self.tool, self.job_order) adjustDirObjs(self.job_order, trim_listing) return workflowmapper @@ -191,7 +207,7 @@ class Runner(object): else: processStatus = "permanentFail" - outputs = None + outputs = {} try: try: self.final_output = record["output"] @@ -199,8 +215,10 @@ class Runner(object): api_client=self.arvrunner.api, keep_client=self.arvrunner.keep_client, num_retries=self.arvrunner.num_retries) - with outc.open("cwl.output.json") as f: - outputs = json.load(f) + if "cwl.output.json" in outc: + with outc.open("cwl.output.json") as f: + if f.size() > 0: + outputs = json.load(f) def keepify(fileobj): path = fileobj["location"] if not path.startswith("keep:"): @@ -208,7 +226,8 @@ class Runner(object): adjustFileObjs(outputs, keepify) adjustDirObjs(outputs, keepify) except Exception as e: - logger.error("While getting final output object: %s", e) + logger.exception("While getting final output object: %s", e) self.arvrunner.output_callback(outputs, processStatus) finally: - del self.arvrunner.processes[record["uuid"]] + if record["uuid"] in self.arvrunner.processes: + del self.arvrunner.processes[record["uuid"]]