From 1ca3b77ff42e1bfa0076a27bba1daa0406655082 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 28 Jan 2016 16:41:08 -0500 Subject: [PATCH] 8319: Fix arv-cwl-runner file references when referencing files in Keep. --- sdk/cwl/arvados_cwl/__init__.py | 5 +++-- sdk/python/arvados/commands/run.py | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sdk/cwl/arvados_cwl/__init__.py b/sdk/cwl/arvados_cwl/__init__.py index 4198c34482..cf18894eaa 100644 --- a/sdk/cwl/arvados_cwl/__init__.py +++ b/sdk/cwl/arvados_cwl/__init__.py @@ -166,7 +166,8 @@ class ArvadosJob(object): try: outputs = {} - outputs = self.collect_outputs("keep:" + record["output"]) + if record["output"]: + outputs = self.collect_outputs("keep:" + record["output"]) except Exception as e: logger.exception("Got exception while collecting job outputs:") processStatus = "permanentFail" @@ -188,7 +189,7 @@ class ArvPathMapper(cwltool.pathmapper.PathMapper): self._pathmap[src] = (src, "$(task.keep)/%s" % src[5:]) if src not in self._pathmap: ab = cwltool.pathmapper.abspath(src, basedir) - st = arvados.commands.run.statfile("", ab) + st = arvados.commands.run.statfile("", ab, fnPattern="$(task.keep)/%s/%s") if kwargs.get("conformance_test"): self._pathmap[src] = (src, ab) elif isinstance(st, arvados.commands.run.UploadFile): diff --git a/sdk/python/arvados/commands/run.py b/sdk/python/arvados/commands/run.py index 5c8bced513..ef39be81a4 100644 --- a/sdk/python/arvados/commands/run.py +++ b/sdk/python/arvados/commands/run.py @@ -81,7 +81,7 @@ def determine_project(root, current_user): # ArvFile() (file already exists in a collection), UploadFile() (file needs to # be uploaded to a collection), or simply returns prefix+fn (which yields the # original parameter string). -def statfile(prefix, fn): +def statfile(prefix, fn, fnPattern="$(file %s/%s)", dirPattern="$(dir %s/%s/)"): absfn = os.path.abspath(fn) if os.path.exists(absfn): st = os.stat(absfn) @@ -89,7 +89,7 @@ def statfile(prefix, fn): sp = os.path.split(absfn) (pdh, branch) = is_in_collection(sp[0], sp[1]) if pdh: - return ArvFile(prefix, "$(file %s/%s)" % (pdh, branch)) + return ArvFile(prefix, fnPattern % (pdh, branch)) else: # trim leading '/' for path prefix test later return UploadFile(prefix, absfn[1:]) @@ -97,7 +97,7 @@ def statfile(prefix, fn): sp = os.path.split(absfn) (pdh, branch) = is_in_collection(sp[0], sp[1]) if pdh: - return ArvFile(prefix, "$(dir %s/%s/)" % (pdh, branch)) + return ArvFile(prefix, dirPattern % (pdh, branch)) return prefix+fn -- 2.39.5