Skip to content

Instantly share code, notes, and snippets.

@vitillo
Created August 20, 2015 16:41
Show Gist options
  • Save vitillo/3c503e9ad1b9e7f9ba8e to your computer and use it in GitHub Desktop.
Save vitillo/3c503e9ad1b9e7f9ba8e to your computer and use it in GitHub Desktop.
fileIOReports bug
Display the source blob
Display the rendered blob
Raw
{"nbformat_minor": 0, "cells": [{"execution_count": 3, "cell_type": "code", "source": "import datetime as dt\nimport operator\nimport pandas as pd\nimport ujson as json\n\nfrom moztelemetry import get_pings, get_pings_properties, get_one_ping_per_client\nfrom __future__ import division\n\n%pylab inline", "outputs": [{"output_type": "stream", "name": "stdout", "text": "Populating the interactive namespace from numpy and matplotlib\n"}], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": 4, "cell_type": "code", "source": "pings_v4 = get_pings(sc, app=\"Firefox\", channel=\"nightly\", build_id=(\"20150818000000\", \"20150818999999\"))\n\nentries_v4 = pings_v4.filter(lambda p: p[\"payload\"].get(\"fileIOReports\", None))\\\n .flatMap(lambda p: [len(v) for k, v in p[\"payload\"][\"fileIOReports\"].iteritems()])\\\n .collect()\n\npd.Series(entries_v4).value_counts()", "outputs": [{"execution_count": 4, "output_type": "execute_result", "data": {"text/plain": "1 91709\n2 43535\n3 11\ndtype: int64"}, "metadata": {}}], "metadata": {"collapsed": false, "trusted": true}}, {"execution_count": 5, "cell_type": "code", "source": "pings_v2 = get_pings(sc, app=\"Firefox\", channel=\"nightly\", build_id=(\"20150818000000\", \"20150818999999\"), schema=\"v2\")\n\nentries_v2 = pings_v2.map(lambda p: json.loads(p))\\\n .filter(lambda p: p.get(\"fileIOReports\", None))\\\n .flatMap(lambda p: [len(v) for k, v in p[\"fileIOReports\"].iteritems()])\\\n .collect()\n \npd.Series(entries_v2).value_counts()", "outputs": [{"execution_count": 5, "output_type": "execute_result", "data": {"text/plain": "3 138528\ndtype: int64"}, "metadata": {}}], "metadata": {"collapsed": false, "trusted": true}}], "nbformat": 4, "metadata": {"kernelspec": {"display_name": "Python 2", "name": "python2", "language": "python"}, "language_info": {"mimetype": "text/x-python", "nbconvert_exporter": "python", "version": "2.7.9", "name": "python", "file_extension": ".py", "pygments_lexer": "ipython2", "codemirror_mode": {"version": 2, "name": "ipython"}}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment