Skip to content

Instantly share code, notes, and snippets.

@vitillo
Created April 22, 2015 12:02
Show Gist options
  • Save vitillo/750e829b64a01d58cfbe to your computer and use it in GitHub Desktop.
Save vitillo/750e829b64a01d58cfbe to your computer and use it in GitHub Desktop.
Architecture breakdown
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:0aa19f360dab174d481f5827cb14b002ceb4ba7f9e51a2c9820dd65612be6a1f"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"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",
"\n",
"from moztelemetry import get_pings, get_pings_properties, get_one_ping_per_client\n",
"\n",
"%pylab inline"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Populating the interactive namespace from numpy and matplotlib\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"pings = get_pings(sc, app=\"Firefox\", channel=\"nightly\", version=\"40.0a1\", submission_date=\"20150414\", fraction=1)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 35
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"subset = get_pings_properties(pings, [\"clientID\", \"info/OS\", \"info/version\", \"info/arch\", \"simpleMeasurements/firstPaint\"])"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 52
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def win_filter(ping):\n",
" return ping[\"OS\"] == \"WINNT\" and ping[\"version\"] == \"6.1\" and \"firstPaint\" in ping\n",
"\n",
"subset = subset.filter(win_filter)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 53
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Per session data:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"frame = pd.DataFrame(subset.collect())\n",
"frame.groupby(\"arch\")[\"firstPaint\"].apply(len)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 54,
"text": [
"arch\n",
"x86 20162\n",
"x86-64 50215\n",
"Name: firstPaint, dtype: int64"
]
}
],
"prompt_number": 54
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Per client data:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"subset = get_one_ping_per_client(subset)\n",
"frame = pd.DataFrame(subset.collect())\n",
"frame.groupby(\"arch\")[\"firstPaint\"].apply(len)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 55,
"text": [
"arch\n",
"x86 5199\n",
"x86-64 12698\n",
"Name: firstPaint, dtype: int64"
]
}
],
"prompt_number": 55
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment