X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/db376a8ddd3a803f4c9c85baf41cb57c6106452f..7c99875efea3ec5415427063cf79ddc44c58f55f:/sdk/cwl/arvados_cwl/done.py diff --git a/sdk/cwl/arvados_cwl/done.py b/sdk/cwl/arvados_cwl/done.py index 313c3925a4..e12fe185a0 100644 --- a/sdk/cwl/arvados_cwl/done.py +++ b/sdk/cwl/arvados_cwl/done.py @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: Apache-2.0 +from future.utils import viewvalues + import re from cwltool.errors import WorkflowException from collections import deque @@ -50,7 +52,7 @@ def done(self, record, tmpdir, outdir, keepdir): def done_outputs(self, record, tmpdir, outdir, keepdir): self.builder.outdir = outdir self.builder.pathmapper.keepdir = keepdir - return self.collect_outputs("keep:" + record["output"]) + return self.collect_outputs("keep:" + record["output"], record["exit_code"]) crunchstat_re = re.compile(r"^\d{4}-\d\d-\d\d_\d\d:\d\d:\d\d [a-z0-9]{5}-8i9sb-[a-z0-9]{15} \d+ \d+ stderr crunchstat:") timestamp_re = re.compile(r"^(\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d+Z) (.*)") @@ -68,7 +70,7 @@ def logtail(logcollection, logfunc, header, maxlen=25): logname = log[:-4] logt = deque([], maxlen) mergelogs[logname] = logt - with logcollection.open(log) as f: + with logcollection.open(log, encoding="utf-8") as f: for l in f: if containersapi: g = timestamp_re.match(l) @@ -91,7 +93,7 @@ def logtail(logcollection, logfunc, header, maxlen=25): loglines.append("%s %s %s" % (ts, earliest, msg)) loglines = loglines[-maxlen:] else: - loglines = list(mergelogs.values())[0] + loglines = mergelogs[list(mergelogs)[0]] logtxt = "\n ".join(l.strip() for l in loglines) logfunc("%s\n\n %s", header, logtxt)