Skip to content

Instantly share code, notes, and snippets.

@ddurst
Created May 22, 2017 21:05
Show Gist options
  • Save ddurst/a98582a8969e2b0e2eb83bac1cecdcb6 to your computer and use it in GitHub Desktop.
Save ddurst/a98582a8969e2b0e2eb83bac1cecdcb6 to your computer and use it in GitHub Desktop.
Plugin Safety install count
Display the source blob
Display the rendered blob
Raw
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[ ]:
from moztelemetry import get_pings_properties, get_one_ping_per_client
from moztelemetry.dataset import Dataset
sc.defaultParallelism
# In[ ]:
start_date_str = '20170504'
pings = Dataset.from_source("telemetry") .where(docType='shield_study') .where(submissionDate=lambda b: (b == start_date_str or b > start_date_str)) .where(appUpdateChannel="release") .records(sc, sample=1.0)
pings_props = get_pings_properties(pings, ["clientId", "payload/study_state"])
(pings_props
.filter(lambda p: p['payload/study_state'] == 'install')
.groupBy(lambda p: p['clientId'])
.count()
) - (pings_props
.filter(lambda p: p['payload/study_state'] == 'user-ended-study')
.groupBy(lambda p: p['clientId'])
.count()
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment