Skip to content

Commit 84e834e

Browse files
committed
caching: also consider stderr
1 parent 7fb1e95 commit 84e834e

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

cwltool/command_line_tool.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
ACCEPTLIST_EN_STRICT_RE = re.compile(r"^[a-zA-Z0-9._+-]+$")
5050
ACCEPTLIST_EN_RELAXED_RE = re.compile(r".*") # Accept anything
5151
ACCEPTLIST_RE = ACCEPTLIST_EN_STRICT_RE
52-
DEFAULT_CONTAINER_MSG =\
53-
"""We are on Microsoft Windows and not all components of this CWL description have a
52+
DEFAULT_CONTAINER_MSG = """
53+
We are on Microsoft Windows and not all components of this CWL description have a
5454
container specified. This means that these steps will be executed in the default container,
5555
which is %s.
5656
@@ -311,19 +311,23 @@ def job(self,
311311
# not really run using docker, just for hashing purposes
312312
keydict = {u"cmdline": cmdline}
313313

314-
if "stdout" in self.tool:
315-
keydict["stdout"] = self.tool["stdout"]
316-
for location, f in cachebuilder.pathmapper.items():
317-
if f.type == "File":
318-
checksum = next((e['checksum'] for e in cachebuilder.files
319-
if 'location' in e and e['location'] == location
320-
and 'checksum' in e
321-
and e['checksum'] != 'sha1$hash'), None)
322-
st = os.stat(f.resolved)
314+
for shortcut in ["stdout", "stderr"]: # later, add "stdin"
315+
if shortcut in self.tool:
316+
keydict[shortcut] = self.tool[shortcut]
317+
318+
for location, fobj in cachebuilder.pathmapper.items():
319+
if fobj.type == "File":
320+
checksum = next(
321+
(e['checksum'] for e in cachebuilder.files
322+
if 'location' in e and e['location'] == location
323+
and 'checksum' in e
324+
and e['checksum'] != 'sha1$hash'), None)
325+
fobj_stat = os.stat(fobj.resolved)
323326
if checksum:
324-
keydict[f.resolved] = [st.st_size, checksum]
327+
keydict[fobj.resolved] = [fobj_stat.st_size, checksum]
325328
else:
326-
keydict[f.resolved] = [st.st_size, int(st.st_mtime * 1000)]
329+
keydict[fobj.resolved] = [fobj_stat.st_size,
330+
int(fobj_stat.st_mtime * 1000)]
327331

328332
interesting = {"DockerRequirement",
329333
"EnvVarRequirement",

0 commit comments

Comments
 (0)