sort the graph list by number of fails

this sorts the graph list by the number of fails found during the
time period. That will naturally make the worst issues float to
the top.

Ensure our time span is a full 14 days.

Change-Id: Ic26e7b2196b80fae969a768289e0550a46de8579
This commit is contained in:
Sean Dague 2013-12-06 15:44:12 -05:00
parent 398425bc3d
commit a2c26cbc0c

View File

@ -42,7 +42,7 @@ def main():
ts = datetime(ts.year, ts.month, ts.day, ts.hour)
# ms since epoch
now = int(((ts - epoch).total_seconds()) * 1000)
start = now - (7 * 24 * STEP)
start = now - (14 * 24 * STEP)
for query in classifier.queries:
urlq = dict(search=query['query'],
@ -54,9 +54,17 @@ def main():
bug = dict(number=query['bug'],
query=query['query'],
logstash_query=logstash_query,
fails=0,
data=[])
buglist.append(bug)
results = classifier.hits_by_query(query['query'], size=3000)
facets_for_fail = er_results.FacetSet()
facets_for_fail.detect_facets(results,
["build_status", "build_uuid"])
if "FAILURE" in facets_for_fail:
bug['fails'] = len(facets_for_fail['FAILURE'])
facets = er_results.FacetSet()
facets.detect_facets(results,
["build_status", "timestamp", "build_uuid"])
@ -70,6 +78,8 @@ def main():
data.append([ts, 0])
bug["data"].append(dict(label=status, data=data))
buglist = sorted(buglist, key=lambda bug: -bug['fails'])
out = open(args.output, 'w')
out.write(json.dumps(buglist))
out.close()