Skip to content

Commit

Permalink
Third round of comments (Metrics)
Browse files Browse the repository at this point in the history
  • Loading branch information
samanvp committed Jul 11, 2019
1 parent b14abb8 commit 91044eb
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 35 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ RUN curl -L -o /usr/bin/kubectl https://storage.googleapis.com/kubernetes-releas
ADD LICENSE /
ADD gcp_deepvariant_runner.py /opt/deepvariant_runner/src/
ADD gke_cluster.py /opt/deepvariant_runner/src/
ADD metrics.py /opt/deepvariant_runner/src/
ADD process_util.py /opt/deepvariant_runner/src/
ADD run_and_verify.sh /opt/deepvariant_runner/bin/
ADD cancel /opt/deepvariant_runner/bin/
Expand Down
6 changes: 3 additions & 3 deletions metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
_DEEP_VARIANT_RUN = 'DeepVariantRun'
_HTTP_REQUEST_TIMEOUT_SEC = 10
_PYTHON = 'PYTHON'
_VIRTUAL_CHC_DEEPVARIANT = 'virtual.chc.deepvariant'
_VIRTUAL_HCLS_DEEPVARIANT = 'virtual.hcls.deepvariant'


def capture_exceptions(func):
Expand Down Expand Up @@ -85,7 +85,7 @@ def __init__(self,
def to_json(self, **kwargs):
"""Encodes data in json."""
event_dict = {
'project_number': self._project_number,
'project_number': str(self._project_number),
'event_name': self._event_name,
'event_type': self._event_type,
'console_type': self._console_type,
Expand Down Expand Up @@ -118,7 +118,7 @@ def add_metrics(self, project_number: int,
event_type=_DEEP_VARIANT_RUN,
project_number=project_number,
console_type=_CLOUD_HCLS,
page_hostname=_VIRTUAL_CHC_DEEPVARIANT,
page_hostname=_VIRTUAL_HCLS_DEEPVARIANT,
event_metadata={k: v for k, v in metrics_kw.items()})
self._events.append(concord_event)

Expand Down
70 changes: 38 additions & 32 deletions metrics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,43 +87,49 @@ def test_submit_metrics(self, unused_mock_time, mock_requests_post):
json.dumps(
{
'console_type': 'CLOUD_HCLS',
'event_metadata': [{
'key': 'attribute_1',
'value': '1'
},
{
'key': 'attribute_2',
'value': 'string-1'
},
{
'key': 'attribute_3',
'value': 'True'
}],
'event_metadata': [
{
'key': 'attribute_1',
'value': '1'
},
{
'key': 'attribute_2',
'value': 'string-1'
},
{
'key': 'attribute_3',
'value': 'True'
}
],
'event_name': 'test-metrics-1',
'event_type': 'DeepVariantRun',
'page_hostname': 'virtual.chc.deepvariant',
'project_number': 123
'page_hostname': 'virtual.hcls.deepvariant',
'project_number': '123'
},
sort_keys=True)
},
{
'source_extension_json':
json.dumps({
'console_type': 'CLOUD_HCLS',
'event_metadata': [{
'key': 'attribute_1',
'value': '2'
}, {
'key': 'attribute_2',
'value': 'string-2'
}, {
'key': 'attribute_3',
'value': 'True'
}],
'event_metadata': [
{
'key': 'attribute_1',
'value': '2'
},
{
'key': 'attribute_2',
'value': 'string-2'
},
{
'key': 'attribute_3',
'value': 'True'
}
],
'event_name': 'test-metrics-2',
'event_type': 'DeepVariantRun',
'page_hostname': 'virtual.chc.deepvariant',
'project_number': 123
'page_hostname': 'virtual.hcls.deepvariant',
'project_number': '123'
},
sort_keys=True)
}
Expand Down Expand Up @@ -162,8 +168,8 @@ def expected_post_data(request_time_ms):
}],
'event_name': 'test-metrics-1',
'event_type': 'DeepVariantRun',
'page_hostname': 'virtual.chc.deepvariant',
'project_number': 123
'page_hostname': 'virtual.hcls.deepvariant',
'project_number': '123'
},
sort_keys=True)
},
Expand All @@ -177,8 +183,8 @@ def expected_post_data(request_time_ms):
}],
'event_name': 'test-metrics-2',
'event_type': 'DeepVariantRun',
'page_hostname': 'virtual.chc.deepvariant',
'project_number': 123
'page_hostname': 'virtual.hcls.deepvariant',
'project_number': '123'
},
sort_keys=True)
},
Expand All @@ -192,8 +198,8 @@ def expected_post_data(request_time_ms):
}],
'event_name': 'test-metrics-3',
'event_type': 'DeepVariantRun',
'page_hostname': 'virtual.chc.deepvariant',
'project_number': 123
'page_hostname': 'virtual.hcls.deepvariant',
'project_number': '123'
},
sort_keys=True)
}
Expand Down

0 comments on commit 91044eb

Please sign in to comment.