Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metrics module to DeepVariant Runner #19

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

samanvp
Copy link
Member

@samanvp samanvp commented Jun 28, 2019

This PR contains the implementation of a class to collect metrics from DeepVariant Runner.

A second PR will utilize the newly defined class in a decorator to collect usage metrics.

@samanvp samanvp requested a review from allieychen June 28, 2019 16:44
Copy link

@allieychen allieychen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Saman! It looks great!

metrics.py Outdated Show resolved Hide resolved
import logging
import time
import uuid
import requests

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please keep it sorted.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving requests before time causes a lint error. I think because requests is considered a 3rd party module.
I added a new line before requests to make it clear it's in a new 'list'.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see! Yes, for 3rd party module we add them in a separate group. And a blank line between each group is the right way to go. Can you move from typing import Dict, Optional to the first group then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving that line to the first group caused a lint error, why do you think typing is not third party module?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting. We don't have typing in the setup.py file (in Variant Transforms), so it should be python build in. I don't know whether it is different for Python 3. But if the lint complains, let's follow that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Allie for your comments and attention to details.

metrics.py Outdated
"""Encapsulates information representing a Concord event."""

def __init__(self,
event_name,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider add type to increase readability.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

metrics.py Outdated Show resolved Hide resolved
metrics.py Outdated Show resolved Hide resolved
metrics.py Show resolved Hide resolved
metrics.py Outdated Show resolved Hide resolved
metrics.py Outdated Show resolved Hide resolved
Copy link
Member Author

@samanvp samanvp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Allie for your comments.

metrics.py Outdated Show resolved Hide resolved
import logging
import time
import uuid
import requests
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving requests before time causes a lint error. I think because requests is considered a 3rd party module.
I added a new line before requests to make it clear it's in a new 'list'.

metrics.py Outdated Show resolved Hide resolved
metrics.py Outdated Show resolved Hide resolved
metrics.py Outdated Show resolved Hide resolved
metrics.py Outdated
"""Encapsulates information representing a Concord event."""

def __init__(self,
event_name,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

metrics.py Show resolved Hide resolved
metrics.py Outdated Show resolved Hide resolved
Copy link

@allieychen allieychen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Saman! I have added some comments for the test.

import logging
import time
import uuid
import requests

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see! Yes, for 3rd party module we add them in a separate group. And a blank line between each group is the right way to go. Can you move from typing import Dict, Optional to the first group then?

metrics.py Outdated Show resolved Hide resolved
metrics.py Show resolved Hide resolved
metrics_test.py Outdated Show resolved Hide resolved
metrics_test.py Outdated Show resolved Hide resolved
metrics_test.py Outdated Show resolved Hide resolved
metrics_test.py Outdated Show resolved Hide resolved
metrics_test.py Outdated Show resolved Hide resolved
Copy link

@kemp-google kemp-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just nits

metrics.py Outdated
_DEEP_VARIANT_RUN = 'DeepVariantRun'
_HTTP_REQUEST_TIMEOUT_SEC = 10
_PYTHON = 'PYTHON'
_VIRTUAL_CHC_DEEPVARIANT = 'virtual.chc.deepvariant'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this name set in stone already? otherwise virtual.hcls.deepvariant would be preferable

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not really sure if changing this will affect anything in a bad way. I am running tests now and will update this comments as soon as I find out more.

import requests
from typing import Dict, Optional, Text

_CLEARCUT_ENDPOINT = 'https://play.googleapis.com/log'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional, but, in general, constants that are (1) only used once and (2) not expected to be tweaked could just be inlined.

So, for example, we are not likely to change anything in this list except maybe the request timeout

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess another benefit of having all these constant values here is the ease of finding them instead of scattered at different parts of code.
So if you don't mind I am going to keep them as is.

Copy link

@allieychen allieychen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Saman!

import logging
import time
import uuid
import requests

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting. We don't have typing in the setup.py file (in Variant Transforms), so it should be python build in. I don't know whether it is different for Python 3. But if the lint complains, let's follow that.

Copy link
Member Author

@samanvp samanvp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you both.
As soon as I get any info from our metrics I will update here.

import logging
import time
import uuid
import requests
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Allie for your comments and attention to details.

import requests
from typing import Dict, Optional, Text

_CLEARCUT_ENDPOINT = 'https://play.googleapis.com/log'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess another benefit of having all these constant values here is the ease of finding them instead of scattered at different parts of code.
So if you don't mind I am going to keep them as is.

metrics.py Outdated
_DEEP_VARIANT_RUN = 'DeepVariantRun'
_HTTP_REQUEST_TIMEOUT_SEC = 10
_PYTHON = 'PYTHON'
_VIRTUAL_CHC_DEEPVARIANT = 'virtual.chc.deepvariant'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not really sure if changing this will affect anything in a bad way. I am running tests now and will update this comments as soon as I find out more.

@samanvp samanvp force-pushed the metrics branch 2 times, most recently from 239b0f8 to 91044eb Compare July 11, 2019 22:30
This PR contains the implementation of a decorator to collect metrics from DeepVariant Runner.

A second PR will utilize the newly defined decorator to collect usage metrics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants