Skip to content

Commit 9eddc55

Browse files
author
radhika
committed
cwltool: add compute_checksum command line argument
1 parent acea9ba commit 9eddc55

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

cwltool/draft2tool.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ def __init__(self, job, output_callback, cachebuilder, jobcache):
108108
def run(self, **kwargs):
109109
# type: (**Any) -> None
110110
self.output_callback(self.job.collect_output_ports(self.job.tool["outputs"],
111-
self.cachebuilder, self.outdir),
111+
self.cachebuilder,
112+
self.outdir,
113+
kwargs.get("compute_checksum")),
112114
"success")
113115

114116
# map files to assigned path inside a container. We need to also explicitly
@@ -334,12 +336,12 @@ def rm_pending_output_callback(output_callback, jobcachepending,
334336

335337
j.pathmapper = builder.pathmapper
336338
j.collect_outputs = partial(
337-
self.collect_output_ports, self.tool["outputs"], builder)
339+
self.collect_output_ports, self.tool["outputs"], builder, compute_checksum=kwargs.get("compute_checksum"))
338340
j.output_callback = output_callback
339341

340342
yield j
341343

342-
def collect_output_ports(self, ports, builder, outdir):
344+
def collect_output_ports(self, ports, builder, outdir, compute_checksum=True):
343345
# type: (Set[Dict[str,Any]], Builder, str) -> Dict[unicode, Union[unicode, List[Any], Dict[unicode, Any]]]
344346
try:
345347
ret = {} # type: Dict[unicode, Union[unicode, List[Any], Dict[unicode, Any]]]
@@ -361,7 +363,7 @@ def collect_output_ports(self, ports, builder, outdir):
361363
for port in ports:
362364
fragment = shortname(port["id"])
363365
try:
364-
ret[fragment] = self.collect_output(port, builder, outdir)
366+
ret[fragment] = self.collect_output(port, builder, outdir, compute_checksum)
365367
except Exception as e:
366368
_logger.debug(u"Error collecting output for parameter '%s'" % shortname(port["id"]), exc_info=e)
367369
raise WorkflowException(u"Error collecting output for parameter '%s': %s" % (shortname(port["id"]), e))
@@ -477,6 +479,6 @@ def collect_output(self, schema, builder, outdir, compute_checksum=True):
477479
out = {}
478480
for f in schema["type"]["fields"]:
479481
out[shortname(f["name"])] = self.collect_output( # type: ignore
480-
f, builder, outdir)
482+
f, builder, outdir, compute_checksum)
481483
return out
482484
return r

cwltool/main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ def arg_parser(): # type: () -> argparse.ArgumentParser
158158
help="Desired workflow behavior when a step fails. One of 'stop' or 'continue'. "
159159
"Default is 'stop.", default="stop")
160160

161+
parser.add_argument("--compute-checksum", action="store_true", default=True,
162+
help="Compute checksum of contents while collecting outputs",
163+
dest="compute_checksum")
164+
parser.add_argument("--no-compute-checksum", action="store_false",
165+
help="Compute checksum of contents while collecting outputs",
166+
dest="compute_checksum")
167+
161168
parser.add_argument("workflow", type=str, nargs="?", default=None)
162169
parser.add_argument("job_order", nargs=argparse.REMAINDER)
163170

0 commit comments

Comments
 (0)