-
-
Save chutten/870e97c789096edb2752a67b23d3a079 to your computer and use it in GitHub Desktop.
prelim_kill_hard
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
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## SUBPROCESS_KILL_HARD" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"from montecarlino import grouped_permutation_test" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"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", | |
"WARNING: " | |
] | |
}, | |
{ | |
"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": [ | |
"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": 3, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"640" | |
] | |
}, | |
"execution_count": 3, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"sc.defaultParallelism" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 14, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"pings = get_pings(sc, app=\"Firefox\", channel=\"beta\", version=\"47.0\", build_id=(\"20160505000000\", \"20160511999999\"), fraction=1)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"... and extract only the attributes we need from the Telemetry submissions:" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 15, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"subset = get_pings_properties(pings, [\"clientId\",\n", | |
" \"environment/settings/e10sCohort\",\n", | |
" \"payload/keyedHistograms/SUBPROCESS_CRASHES_WITH_DUMP\",\n", | |
" \"payload/keyedHistograms/SUBPROCESS_KILL_HARD\"], with_processes=True)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 16, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"subset = subset.filter(lambda p: p[\"environment/settings/e10sCohort\"] in [\"test\", \"control\"])" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"metadata": { | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"subset = subset.filter(lambda p: p[\"payload/keyedHistograms/SUBPROCESS_CRASHES_WITH_DUMP\"] is not None)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 18, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"subset = get_one_ping_per_client(subset)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 19, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"cached = subset.cache()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 20, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"87430" | |
] | |
}, | |
"execution_count": 20, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"cached.count()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 21, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"defaultdict(int, {u'control': 16683, u'test': 70747})" | |
] | |
}, | |
"execution_count": 21, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"cached.map(lambda p: (p[\"environment/settings/e10sCohort\"], 1)).countByKey()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 22, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"(65179L, 5568L)" | |
] | |
}, | |
"execution_count": 22, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"def get_content_crashes(p):\n", | |
" crashes = p[\"payload/keyedHistograms/SUBPROCESS_CRASHES_WITH_DUMP\"]\n", | |
" if crashes is not None and crashes.get(\"content\", None) is not None:\n", | |
" return crashes[\"content\"]\n", | |
" return 0\n", | |
"\n", | |
"e10s_content_crashes = cached.filter(lambda p: p[\"environment/settings/e10sCohort\"] == \"test\").map(get_content_crashes).reduce(lambda a, b: a + b)\n", | |
"none10s_content_crashes = cached.filter(lambda p: p[\"environment/settings/e10sCohort\"] == \"control\").map(get_content_crashes).reduce(lambda a, b: a + b)\n", | |
"e10s_content_crashes, none10s_content_crashes" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 23, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"(55751L, 5295L)" | |
] | |
}, | |
"execution_count": 23, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"def get_shutdown_kills(p):\n", | |
" kill_hards = p[\"payload/keyedHistograms/SUBPROCESS_KILL_HARD\"]\n", | |
" if kill_hards is not None and kill_hards.get(\"ShutDownKill\", None) is not None:\n", | |
" return kill_hards[\"ShutDownKill\"]\n", | |
" return 0\n", | |
"\n", | |
"e10s_shutdown_kills = cached.filter(lambda p: p[\"environment/settings/e10sCohort\"] == \"test\").map(get_shutdown_kills).reduce(lambda a, b: a + b)\n", | |
"none10s_shutdown_kills = cached.filter(lambda p: p[\"environment/settings/e10sCohort\"] == \"control\").map(get_shutdown_kills).reduce(lambda a, b: a + b)\n", | |
"e10s_shutdown_kills, none10s_shutdown_kills" | |
] | |
} | |
], | |
"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 | |
} |
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 | |
# ## SUBPROCESS_KILL_HARD | |
# In[1]: | |
from montecarlino import grouped_permutation_test | |
# In[2]: | |
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[3]: | |
sc.defaultParallelism | |
# In[14]: | |
pings = get_pings(sc, app="Firefox", channel="beta", version="47.0", build_id=("20160505000000", "20160511999999"), fraction=1) | |
# ... and extract only the attributes we need from the Telemetry submissions: | |
# In[15]: | |
subset = get_pings_properties(pings, ["clientId", | |
"environment/settings/e10sCohort", | |
"payload/keyedHistograms/SUBPROCESS_CRASHES_WITH_DUMP", | |
"payload/keyedHistograms/SUBPROCESS_KILL_HARD"], with_processes=True) | |
# In[16]: | |
subset = subset.filter(lambda p: p["environment/settings/e10sCohort"] in ["test", "control"]) | |
# In[17]: | |
subset = subset.filter(lambda p: p["payload/keyedHistograms/SUBPROCESS_CRASHES_WITH_DUMP"] is not None) | |
# In[18]: | |
subset = get_one_ping_per_client(subset) | |
# In[19]: | |
cached = subset.cache() | |
# In[20]: | |
cached.count() | |
# In[21]: | |
cached.map(lambda p: (p["environment/settings/e10sCohort"], 1)).countByKey() | |
# In[22]: | |
def get_content_crashes(p): | |
crashes = p["payload/keyedHistograms/SUBPROCESS_CRASHES_WITH_DUMP"] | |
if crashes is not None and crashes.get("content", None) is not None: | |
return crashes["content"] | |
return 0 | |
e10s_content_crashes = cached.filter(lambda p: p["environment/settings/e10sCohort"] == "test").map(get_content_crashes).reduce(lambda a, b: a + b) | |
none10s_content_crashes = cached.filter(lambda p: p["environment/settings/e10sCohort"] == "control").map(get_content_crashes).reduce(lambda a, b: a + b) | |
e10s_content_crashes, none10s_content_crashes | |
# In[23]: | |
def get_shutdown_kills(p): | |
kill_hards = p["payload/keyedHistograms/SUBPROCESS_KILL_HARD"] | |
if kill_hards is not None and kill_hards.get("ShutDownKill", None) is not None: | |
return kill_hards["ShutDownKill"] | |
return 0 | |
e10s_shutdown_kills = cached.filter(lambda p: p["environment/settings/e10sCohort"] == "test").map(get_shutdown_kills).reduce(lambda a, b: a + b) | |
none10s_shutdown_kills = cached.filter(lambda p: p["environment/settings/e10sCohort"] == "control").map(get_shutdown_kills).reduce(lambda a, b: a + b) | |
e10s_shutdown_kills, none10s_shutdown_kills | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment