Skip to content

Commit

Permalink
First round of comments (metrics utilization)
Browse files Browse the repository at this point in the history
  • Loading branch information
samanvp committed Jul 23, 2019
1 parent 3978915 commit f05ca90
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
16 changes: 12 additions & 4 deletions gcp_deepvariant_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,13 +315,13 @@ def wrapper(pipeline_args, *args, **kwargs):
if pipeline_args.stop_collecting_anonymous_usage_metrics:
func(pipeline_args, *args, **kwargs)
else:
success = False
status = '_Failure'
start = time.time()
try:
func(pipeline_args, *args, **kwargs)
success = True
status = '_Success'
finally:
metrics_name = method_name + ('_Success' if success else '_Failure')
metrics_name = method_name + status
metrics.add(
_get_project_number(pipeline_args.project),
metrics_name,
Expand Down Expand Up @@ -1106,7 +1106,11 @@ def run(argv=None):
'--stop_collecting_anonymous_usage_metrics',
default=False,
action='store_true',
help=('Use preemptible VMs for the pipeline.'))
help=('This tool collects some anonymous metrics related to utilized '
'resources, such as how many workers, how many CPU cores, how much '
'ram, etc. was used to run each step of DeepVariant. We use these '
'metrics to further improve the usibility of our tool. You can '
'compeletly stop collecting these metrics by setting this flag.'))

pipeline_args = parser.parse_args(argv)
_validate_and_complete_args(pipeline_args)
Expand All @@ -1124,6 +1128,10 @@ def get_model_version(model):
# General run related settings.
image_version=get_image_version(pipeline_args.docker_image),
model_version=get_model_version(pipeline_args.model),
input_file_format=(
_BAM_FILE_SUFFIX if pipeline_args.bam.endswith(_BAM_FILE_SUFFIX)
else _CRAM_FILE_SUFFIX),
zones=pipeline_args.zones,
genomic_regions=(
len(pipeline_args.regions) if pipeline_args.regions else 0),
shards=pipeline_args.shards,
Expand Down
4 changes: 3 additions & 1 deletion gcp_deepvariant_runner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ def testRunPipeline_Metrics(self, mock_metrics_add, mock_get_project_number,
gpu=True,
gvcf=True,
image_version='tag',
input_file_format='.cram',
jobs_to_run=[
'make_examples', 'call_variants', 'postprocess_variants'],
make_examples_cores_per_worker=8,
Expand All @@ -675,7 +676,8 @@ def testRunPipeline_Metrics(self, mock_metrics_add, mock_get_project_number,
postprocess_variants_ram_gb=16,
preemptible=False,
shards=16,
tpu=False),
tpu=False,
zones=['zone-a', 'zone-b']),
mock.call(1000, 'MakeExamples_Success', duration_seconds=0),
mock.call(1000, 'CallVariants_Success', duration_seconds=0),
mock.call(1000, 'PostprocessVariants_Success', duration_seconds=0)
Expand Down

0 comments on commit f05ca90

Please sign in to comment.