Created
April 12, 2017 20:46
-
-
Save sunahsuh/e4c27018a28df4514e55dad037fb3415 to your computer and use it in GitHub Desktop.
Bug 1355712 - Validate new hour-precision (sub)SessionStart Dates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# In[26]: | |
sc.defaultParallelism | |
# In[27]: | |
from moztelemetry.dataset import Dataset | |
from moztelemetry import get_pings_properties | |
from dateutil import parser | |
get_ipython().magic(u'matplotlib inline') | |
# In[30]: | |
pings = Dataset.from_source("telemetry") .where(docType='main') .where(submissionDate=lambda d: d >= "20170406") .where(appUpdateChannel="nightly") .records(sc, sample=1) | |
# In[31]: | |
pings.count() | |
# In[32]: | |
subset = get_pings_properties(pings, ["application/buildId", "meta/submissionDate", "payload/info/sessionStartDate", "payload/info/subsessionStartDate"]) | |
# In[33]: | |
filtered = subset.filter(lambda p: p["application/buildId"] > "20170406000000").persist() | |
# In[34]: | |
filtered.take(10) | |
# In[35]: | |
filtered.count() | |
# In[36]: | |
filtered.map(lambda p: parser.parse(p["payload/info/sessionStartDate"]).time()).countByValue() | |
# In[37]: | |
filtered.map(lambda p: parser.parse(p["payload/info/subsessionStartDate"]).time()).countByValue() | |
# In[ ]: | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment