Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunahsuh/e4c27018a28df4514e55dad037fb3415 to your computer and use it in GitHub Desktop.
Save sunahsuh/e4c27018a28df4514e55dad037fb3415 to your computer and use it in GitHub Desktop.
Bug 1355712 - Validate new hour-precision (sub)SessionStart Dates
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# 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