Merge "Sort uncategorized fails by time"

This commit is contained in:
Jenkins 2014-01-22 11:56:45 +00:00 committed by Gerrit Code Review
commit 217dc8842f
2 changed files with 18 additions and 2 deletions

View File

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

View File

@ -25,7 +25,8 @@ Overall Categorization Rate: {{ rate }}
<h2>{{ job[0] }} : {{ job[1] }} Uncategorized Fails</h2> <h2>{{ job[0] }} : {{ job[1] }} Uncategorized Fails</h2>
<ul> <ul>
{% for url in urls[job[0]] %} {% 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 %} {% endfor %}
</ul> </ul>
{% endfor %} {% endfor %}