Created
May 22, 2017 21:05
-
-
Save ddurst/a98582a8969e2b0e2eb83bac1cecdcb6 to your computer and use it in GitHub Desktop.
Plugin Safety install count
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[ ]: | |
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