Skip to content

Instantly share code, notes, and snippets.

@ahal
Last active January 8, 2018 22:49
Show Gist options
  • Save ahal/792eae6fafb557a6955d3fd9cf93d94e to your computer and use it in GitHub Desktop.
Save ahal/792eae6fafb557a6955d3fd9cf93d94e to your computer and use it in GitHub Desktop.
Bugzilla component info for the Testing product
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"PRODUCT = 'Testing'"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"!pip install requests\n",
"!pip install terminaltables\n",
"\n",
"from datetime import datetime\n",
"\n",
"import requests\n",
"from terminaltables import GithubFlavoredMarkdownTable"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"def get_components(product):\n",
" query = \"https://bugzilla.mozilla.org/rest/product/{}?include_fields=components.name\".format(product)\n",
" data = requests.get(query).json()\n",
" data = data['products'][0]['components']\n",
" return [c['name'] for c in data]\n",
"\n",
"def get_bugs(component):\n",
" query = \"https://bugzilla.mozilla.org/rest/bug?product={}&component={}&status=NEW&status=ASSIGNED&include_fields=last_change_time\".format(PRODUCT, component)\n",
" data = requests.get(query).json()\n",
" return [b['last_change_time'] for b in data['bugs']]"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"components = get_components(PRODUCT)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"result = [('Component', 'Number of open bugs', 'Most recently modified (open)')]\n",
"\n",
"for component in components:\n",
" bugs = get_bugs(component)\n",
" date_format = '%Y-%m-%dT%H:%M:%SZ'\n",
" dates = [datetime.strptime(t, date_format) for t in bugs]\n",
" most_recent = 'NA'\n",
" if dates:\n",
" most_recent = str(max(dates)).split()[0]\n",
" result.append((component, len(bugs), most_recent))\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"table = GithubFlavoredMarkdownTable(result)\n",
"print(table.table)"
]
}
],
"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.13"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Component Number of open bugs Most recently modified (open)
ActiveData 69 2017-11-16
Autophone 41 2018-01-01
AWFY 9 2018-01-08
AWSY 9 2018-01-08
BrowserTest 34 2017-12-21
Code Coverage 59 2018-01-08
external-media-tests 11 2017-06-26
Fennec Profile Tool 0 NA
Firefox UI Tests 91 2018-01-08
geckodriver 43 2018-01-08
General 550 2018-01-08
httpd.js 20 2017-12-25
JSMarionette 197 2017-10-20
Lint 58 2018-01-08
Marionette 304 2018-01-08
Minotaur 3 2014-06-25
Mochitest 397 2018-01-08
Mochitest Chrome 28 2018-01-03
Mozbase 302 2018-01-08
mozregression 89 2018-01-07
mozscreenshots 15 2018-01-08
New Frameworks 25 2016-01-22
Orangutan 1 2014-07-22
Peptest 10 2014-10-28
ProfileManager 33 2017-10-12
Reftest 169 2018-01-08
Sisyphus 10 2017-06-24
ssltunnel 1 2016-01-06
SUTAgent 3 2014-08-01
Talos 120 2018-01-08
Test Informant 4 2015-03-16
TPS 14 2017-08-16
web-platform-tests 643 2018-01-08
WebQA 0 NA
XPCShell Harness 148 2018-01-08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment