Skip to content

Commit acea9ba

Browse files
author
radhika
committed
cwltool: Add a compute_checksum optional argument to compute_checksum with default value of True. When False, skip checksum computing which can be expensive.
1 parent 03cb519 commit acea9ba

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cwltool/draft2tool.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ def collect_output_ports(self, ports, builder, outdir):
374374
except validate.ValidationException as e:
375375
raise WorkflowException("Error validating output record, " + str(e) + "\n in " + json.dumps(ret, indent=4))
376376

377-
def collect_output(self, schema, builder, outdir):
377+
def collect_output(self, schema, builder, outdir, compute_checksum=True):
378378
# type: (Dict[str,Any], Builder, str) -> Union[Dict[unicode, Any], List[Union[Dict[unicode, Any], unicode]]]
379379
r = [] # type: List[Any]
380380
if "outputBinding" in schema:
@@ -414,10 +414,12 @@ def collect_output(self, schema, builder, outdir):
414414
files["contents"] = contents
415415
filesize = 0
416416
while contents != "":
417-
checksum.update(contents)
417+
if compute_checksum:
418+
checksum.update(contents)
418419
filesize += len(contents)
419420
contents = f.read(1024*1024)
420-
files["checksum"] = "sha1$%s" % checksum.hexdigest()
421+
if compute_checksum:
422+
files["checksum"] = "sha1$%s" % checksum.hexdigest()
421423
files["size"] = filesize
422424
if "format" in schema:
423425
files["format"] = builder.do_eval(schema["format"], context=files)

0 commit comments

Comments
 (0)