Skip to content

Commit 6b16701

Browse files
kishwarshafincopybara-github
authored andcommitted
Add logic to run_deepvariant to control postprocess cpus
PiperOrigin-RevId: 575883359
1 parent 69e565d commit 6b16701

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

scripts/run_deepvariant.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@
210210
' has to be flag_name=true or flag_name=false.'
211211
),
212212
)
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+
)
213221
_POSTPROCESS_VARIANTS_EXTRA_ARGS = flags.DEFINE_string(
214222
'postprocess_variants_extra_args',
215223
None,
@@ -436,10 +444,14 @@ def postprocess_variants_command(
436444
ref: str, infile: str, outfile: str, extra_args: str, **kwargs
437445
) -> Tuple[str, Optional[str]]:
438446
"""Returns a postprocess_variants (command, logfile) for subprocess."""
447+
cpus = _POSTPROCESS_CPUS.value
448+
if not cpus:
449+
cpus = _NUM_SHARDS.value
439450
command = ['time', '/opt/deepvariant/bin/postprocess_variants']
440451
command.extend(['--ref', '"{}"'.format(ref)])
441452
command.extend(['--infile', '"{}"'.format(infile)])
442453
command.extend(['--outfile', '"{}"'.format(outfile)])
454+
command.extend(['--cpus', '"{}"'.format(cpus)])
443455
# Extend the command with all items in kwargs and extra_args.
444456
kwargs = _update_kwargs_with_warning(kwargs, _extra_args_to_dict(extra_args))
445457
command = _extend_command_by_args_dict(command, kwargs)

0 commit comments

Comments
 (0)