|
210 | 210 | ' has to be flag_name=true or flag_name=false.'
|
211 | 211 | ),
|
212 | 212 | )
|
| 213 | +# Optional flag for postprocess variants |
| 214 | +_POSTPROCESS_CPUS = flags.DEFINE_integer( |
| 215 | + 'postprocess_cpus', |
| 216 | + None, |
| 217 | + 'Optional. Number of cpus to use during' |
| 218 | + ' postprocess_variants. Set to 0 to disable multiprocessing. Default is' |
| 219 | + ' None which sets to num_shards.', |
| 220 | +) |
213 | 221 | _POSTPROCESS_VARIANTS_EXTRA_ARGS = flags.DEFINE_string(
|
214 | 222 | 'postprocess_variants_extra_args',
|
215 | 223 | None,
|
@@ -436,10 +444,14 @@ def postprocess_variants_command(
|
436 | 444 | ref: str, infile: str, outfile: str, extra_args: str, **kwargs
|
437 | 445 | ) -> Tuple[str, Optional[str]]:
|
438 | 446 | """Returns a postprocess_variants (command, logfile) for subprocess."""
|
| 447 | + cpus = _POSTPROCESS_CPUS.value |
| 448 | + if not cpus: |
| 449 | + cpus = _NUM_SHARDS.value |
439 | 450 | command = ['time', '/opt/deepvariant/bin/postprocess_variants']
|
440 | 451 | command.extend(['--ref', '"{}"'.format(ref)])
|
441 | 452 | command.extend(['--infile', '"{}"'.format(infile)])
|
442 | 453 | command.extend(['--outfile', '"{}"'.format(outfile)])
|
| 454 | + command.extend(['--cpus', '"{}"'.format(cpus)]) |
443 | 455 | # Extend the command with all items in kwargs and extra_args.
|
444 | 456 | kwargs = _update_kwargs_with_warning(kwargs, _extra_args_to_dict(extra_args))
|
445 | 457 | command = _extend_command_by_args_dict(command, kwargs)
|
|
0 commit comments