Forked from ddurst/Plugin Safety install count.ipynb
Last active
May 23, 2017 17:03
-
-
Save squarewave/96385908ef2d045be577398becfe6afb 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"]) | |
filtered = pings_props.filter(lambda p: p['environment/addons/activeAddons/@plugin-safety'] is not None) | |
(filtered | |
.filter(lambda p: p['payload/study_state'] == 'install') | |
.groupBy(lambda p: p['clientId']) | |
.count() | |
) - (filtered | |
.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