Skip to content

Commit 0fa6bd4

Browse files
kapilkd13tetron
authored andcommitted
using stdout field in cachekey calculation (#532)
1 parent 734322e commit 0fa6bd4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cwltool/draft2tool.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ def job(self,
244244
# type: (...) -> Generator[Union[JobBase, CallbackJob], None, None]
245245

246246
jobname = uniquename(kwargs.get("name", shortname(self.tool.get("id", "job"))))
247-
248247
if kwargs.get("cachedir"):
249248
cacheargs = kwargs.copy()
250249
cacheargs["outdir"] = "/out"
@@ -270,6 +269,8 @@ def job(self,
270269
cmdline = ["docker", "run", dockerimg] + cmdline
271270
keydict = {u"cmdline": cmdline}
272271

272+
if "stdout" in self.tool:
273+
keydict["stdout"] = self.tool["stdout"]
273274
for location, f in cachebuilder.pathmapper.items():
274275
if f.type == "File":
275276
checksum = next((e['checksum'] for e in cachebuilder.files

cwltool/load_tool.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import os
77
import re
88
import uuid
9+
import hashlib
10+
import json
911
from typing import Any, Callable, Dict, List, Text, Tuple, Union, cast
1012

1113
import requests.sessions
@@ -88,7 +90,8 @@ def _convert_stdstreams_to_files(workflowobj):
8890
if streamtype in workflowobj:
8991
filename = workflowobj[streamtype]
9092
else:
91-
filename = Text(uuid.uuid4())
93+
filename = Text(hashlib.sha1(json.dumps(workflowobj,
94+
sort_keys=True).encode('utf-8')).hexdigest())
9295
workflowobj[streamtype] = filename
9396
out['type'] = 'File'
9497
out['outputBinding'] = {'glob': filename}

0 commit comments

Comments
 (0)