Sort uncategorized fails by time

A single bad patch in the gate can result in multiple failed jobs (due
to gate resets), sorting and printing timestamps in the list of
uncategorized fails makes these patterns easier to detect.

Change-Id: Ifb2530a521c510d0e07e470bbdc235cd850b4eda
This commit is contained in:
Joe Gordon 2014-01-19 21:23:58 -08:00
parent a58b9b2644
commit 012146d304
2 changed files with 18 additions and 2 deletions

View File

@ -18,6 +18,7 @@ import argparse
import collections
import operator
import re
import time
import jinja2
@ -66,8 +67,13 @@ def all_fails(classifier):
# gate. Would be nice if there was a zuul attr for this in es.
if re.search("(^openstack/|devstack|grenade)", result.project):
name = result.build_name
timestamp = time.strptime(result.timestamp,
"%Y-%m-%dT%H:%M:%S.%fZ")
log = result.log_url.split("console.html")[0]
all_fails["%s.%s" % (build, name)] = log
all_fails["%s.%s" % (build, name)] = {
'log': log,
'timestamp': timestamp
}
return all_fails
@ -106,6 +112,15 @@ def classifying_rate(fails, data, engine):
bad_jobs[job] += 1
bad_job_urls[job].append(fails[f])
for job in bad_job_urls:
# sort by timestamp.
bad_job_urls[job] = sorted(bad_job_urls[job],
key=lambda v: v['timestamp'], reverse=True)
# Convert timestamp into string
for url in bad_job_urls[job]:
url['timestamp'] = time.strftime(
"%Y-%m-%dT%H:%M",
url['timestamp'])
classifying_rate = ((float(count) / float(total)) * 100.0)
sort = sorted(
bad_jobs.iteritems(),

View File

@ -25,7 +25,8 @@ Overall Categorization Rate: {{ rate }}
<h2>{{ job[0] }} : {{ job[1] }} Uncategorized Fails</h2>
<ul>
{% for url in urls[job[0]] %}
<li><a href="{{ url }}">{{ url }}</a></li>
<li>{{url['timestamp']}}: <a href="{{ url['log'] }}">{{ url['log'] }}</a></li>
{% endfor %}
</ul>
{% endfor %}