Skip to content

Instantly share code, notes, and snippets.

@vitillo
Created January 12, 2015 19:21
Show Gist options
  • Select an option

  • Save vitillo/6bcd3459f6b1c00f1658 to your computer and use it in GitHub Desktop.

Select an option

Save vitillo/6bcd3459f6b1c00f1658 to your computer and use it in GitHub Desktop.
Hang Bug
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:d99a34c369aaf929f7ae1503d75078a0d05aaa23c1c9ba015ceb1f172d3d9ea3"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"from __future__ import division\n",
"\n",
"import numpy as np\n",
"import ujson as json\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import IPython\n",
"\n",
"from moztelemetry.spark import get_pings\n",
"from moztelemetry.histogram import Histogram\n",
"\n",
"IPython.core.pylabtools.figsize(18, 7)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 17
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Number of cores:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"sc.defaultParallelism"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 29,
"text": [
"48"
]
}
],
"prompt_number": 29
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Number of pings analyzed:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%capture\n",
"pings = get_pings(sc, \"Firefox\", \"release\", \"34.0.5\", \"*\", (\"20150110\"))\n",
"pings.count()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 19,
"text": [
"3886604"
]
}
],
"prompt_number": 19
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%capture\n",
"\n",
"def extract(ping):\n",
" ping = json.loads(ping) \n",
" locale = ping[\"info\"].get(\"locale\", None)\n",
" return locale.decode(\"utf-8\") #locale is the winner\n",
"\n",
"pings.map(extract).distinct().collect()"
],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment