X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/5c4d9d38dcee73a7ffb6221c80f707c3924da64f..8fd360faf91921c557f44f079b127a4fa5830486:/sdk/cwl/arvados_cwl/done.py diff --git a/sdk/cwl/arvados_cwl/done.py b/sdk/cwl/arvados_cwl/done.py index 25efade2ab..9b26ad7064 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 @@ -57,14 +59,13 @@ timestamp_re = re.compile(r"^(\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d+Z) (.*)") def logtail(logcollection, logfunc, header, maxlen=25): if len(logcollection) == 0: - logfunc(header) - logfunc(" ** log is empty **") + logfunc("%s\n%s", header, " ** log is empty **") return containersapi = ("crunch-run.txt" in logcollection) mergelogs = {} - for log in logcollection.keys(): + for log in list(logcollection): if not containersapi or log in ("crunch-run.txt", "stdout.txt", "stderr.txt"): logname = log[:-4] logt = deque([], maxlen) @@ -78,7 +79,7 @@ def logtail(logcollection, logfunc, header, maxlen=25): logt.append(l) if containersapi: - keys = mergelogs.keys() + keys = list(mergelogs) loglines = [] while True: earliest = None @@ -92,8 +93,7 @@ def logtail(logcollection, logfunc, header, maxlen=25): loglines.append("%s %s %s" % (ts, earliest, msg)) loglines = loglines[-maxlen:] else: - loglines = mergelogs.values()[0] + loglines = mergelogs[list(mergelogs)[0]] logtxt = "\n ".join(l.strip() for l in loglines) - logfunc(header) - logfunc("\n %s", logtxt) + logfunc("%s\n\n %s", header, logtxt)