Skip to content

Instantly share code, notes, and snippets.

@chutten
Last active August 2, 2016 18:45
Show Gist options
  • Save chutten/18c2381855e05a2b6c7e3fe924bd2ada to your computer and use it in GitHub Desktop.
Save chutten/18c2381855e05a2b6c7e3fe924bd2ada to your computer and use it in GitHub Desktop.
e10s_release
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### e10sCohort from main pings on Release\n",
"\n",
"Or, \"How many people on release-48 were running e10s when last we heard from them?\""
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/hadoop/anaconda2/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.\n",
" warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Unable to parse whitelist (/home/hadoop/anaconda2/lib/python2.7/site-packages/moztelemetry/histogram-whitelists.json). Assuming all histograms are acceptable.\n",
"Populating the interactive namespace from numpy and matplotlib\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: pylab import has clobbered these variables: ['Annotation', 'Figure']\n",
"`%matplotlib` prevents importing * from pylab and numpy\n"
]
}
],
"source": [
"import ujson as json\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import numpy as np\n",
"import plotly.plotly as py\n",
"from plotly.graph_objs import *\n",
"\n",
"from moztelemetry import get_pings, get_pings_properties, get_one_ping_per_client, get_clients_history, get_records\n",
"\n",
"%pylab inline"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"64"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sc.defaultParallelism"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"pings = get_pings(sc, app=\"Firefox\", channel=\"release\", version=\"48.0\", fraction=1, doc_type=\"main\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"subset = get_pings_properties(pings, [\"clientId\",\n",
" \"environment/settings/e10sCohort\",\n",
" ])"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"subset = get_one_ping_per_client(subset)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"194829"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"subset_count = subset.count()\n",
"subset_count"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"defaultdict(int,\n",
" {u'control': 80534,\n",
" u'disqualified-control': 109470,\n",
" u'disqualified-test': 1108,\n",
" u'optedIn': 790,\n",
" u'optedOut': 36,\n",
" u'test': 807,\n",
" u'unknown': 1444,\n",
" u'unsupportedChannel': 640})"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"counts = subset.map(lambda p: (p[\"environment/settings/e10sCohort\"], p)).countByKey()\n",
"counts"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.11"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
# coding: utf-8
# ### e10sCohort from main pings on Release
#
# Or, "How many people on release-48 were running e10s when last we heard from them?"
# In[1]:
import ujson as json
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import plotly.plotly as py
from plotly.graph_objs import *
from moztelemetry import get_pings, get_pings_properties, get_one_ping_per_client, get_clients_history, get_records
get_ipython().magic(u'pylab inline')
# In[2]:
sc.defaultParallelism
# In[3]:
pings = get_pings(sc, app="Firefox", channel="release", version="48.0", fraction=1, doc_type="main")
# In[4]:
subset = get_pings_properties(pings, ["clientId",
"environment/settings/e10sCohort",
])
# In[5]:
subset = get_one_ping_per_client(subset)
# In[6]:
subset_count = subset.count()
subset_count
# In[7]:
counts = subset.map(lambda p: (p["environment/settings/e10sCohort"], p)).countByKey()
counts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment