Skip to content

Commit 5b2cd24

Browse files
authored
use checksum instead of modification time for caching, if available (#454)
1 parent dec5440 commit 5b2cd24

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cwltool/draft2tool.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,17 @@ def job(self,
221221
cmdline = ["docker", "run", dockerimg] + cmdline
222222
keydict = {u"cmdline": cmdline}
223223

224-
for _, f in cachebuilder.pathmapper.items():
224+
for location, f in cachebuilder.pathmapper.items():
225225
if f.type == "File":
226+
checksum = next((e['checksum'] for e in cachebuilder.files
227+
if 'location' in e and e['location'] == location
228+
and 'checksum' in e
229+
and e['checksum'] != 'sha1$hash'), None)
226230
st = os.stat(f.resolved)
227-
keydict[f.resolved] = [st.st_size, int(st.st_mtime * 1000)]
231+
if checksum:
232+
keydict[f.resolved] = [st.st_size, checksum]
233+
else:
234+
keydict[f.resolved] = [st.st_size, int(st.st_mtime * 1000)]
228235

229236
interesting = {"DockerRequirement",
230237
"EnvVarRequirement",

0 commit comments

Comments
 (0)