[llvm-commits] [zorg] r126493 - in /zorg/trunk/llvmlab/llvmlab/ui: ci/views.py templates/build_chart.html templates/buildbot_monitor.html
Daniel Dunbar
daniel at zuster.org
Fri Feb 25 08:45:27 PST 2011
Author: ddunbar
Date: Fri Feb 25 10:45:27 2011
New Revision: 126493
URL: http://llvm.org/viewvc/llvm-project?rev=126493&view=rev
Log:
llvmlab: Add a 'ci/build_chart' which shows a Gantt chart of where builds were
done of the past N days.
Added:
zorg/trunk/llvmlab/llvmlab/ui/templates/build_chart.html
Modified:
zorg/trunk/llvmlab/llvmlab/ui/ci/views.py
zorg/trunk/llvmlab/llvmlab/ui/templates/buildbot_monitor.html
Modified: zorg/trunk/llvmlab/llvmlab/ui/ci/views.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/ci/views.py?rev=126493&r1=126492&r2=126493&view=diff
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/ui/ci/views.py (original)
+++ zorg/trunk/llvmlab/llvmlab/ui/ci/views.py Fri Feb 25 10:45:27 2011
@@ -47,6 +47,70 @@
return render_template("buildbot_monitor.html",
bb_status=current_app.config.status)
+ at ci.route('/build_chart')
+def build_chart():
+ import time
+
+ # Determine the render constants.
+ k_days_data = int(request.args.get('days', 1))
+ k_pixels_per_minute = float(request.args.get('pixels_per_minute', .5))
+
+ # Aggregate builds by slave, for completed builds within the desired time
+ # frame.
+ current_time = time.time()
+ builders = current_app.config.status.builders
+ slave_builders = util.multidict(
+ (build.slave, build)
+ for builds in builders.values()
+ for build in builds
+ if build.end_time is not None
+ if current_time - build.start_time < 60 * 60 * 24 * k_days_data)
+
+ # Compute the build chart.
+ class ChartItem(object):
+ def __init__(self, build, color, left, width):
+ self.build = build
+ self.color = color
+ self.left = left
+ self.width = width
+ builder_colors = dict((name, util.make_dark_color(float(i) / len(builders)))
+ for i,name in enumerate(builders))
+ build_chart_data = {}
+ max_x = 0
+ min_time = min(build.start_time
+ for builds in slave_builders.values()
+ for build in builds)
+ for slave, builders in slave_builders.items():
+ # Order the builders by time.
+ builders.sort(key = lambda b: b.start_time)
+
+ # Aggregate builds by builder type.
+ builds_by_type = util.multidict(
+ (build.name, build)
+ for build in builders)
+
+ # Create the char items.
+ rows = []
+ for name,builds in util.sorted(builds_by_type.items()):
+ color = builder_colors[name]
+ hex_color = '%02x%02x%02x' % tuple(int(x*255)
+ for x in color)
+ rows.append([])
+ for build in builds:
+ elapsed = build.end_time - build.start_time
+ width = max(1, int(k_pixels_per_minute * elapsed / 60))
+ left = int(k_pixels_per_minute *
+ (build.start_time - min_time) / 60)
+ max_x = max(max_x, left + width)
+ rows[-1].append(ChartItem(build, hex_color, left, width))
+ build_chart_data[slave] = rows
+
+ build_chart = { 'data' : build_chart_data,
+ 'max_x' : max_x }
+ return render_template("build_chart.html",
+ bb_status = current_app.config.status,
+ build_chart = build_chart)
+
@ci.route('/phase_description/<int:index>')
def phase_description(index):
cfg = current_app.config.summary.config
Added: zorg/trunk/llvmlab/llvmlab/ui/templates/build_chart.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/templates/build_chart.html?rev=126493&view=auto
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/ui/templates/build_chart.html (added)
+++ zorg/trunk/llvmlab/llvmlab/ui/templates/build_chart.html Fri Feb 25 10:45:27 2011
@@ -0,0 +1,64 @@
+{% extends "layout.html" %}
+{% block title %}build chart{% endblock %}
+{% block head %}
+<style type="text/css">
+div.buildbox {
+ position: absolute;
+ height: 25px;
+ border-width: 1px;
+ border-style: solid;
+ border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+}
+tr.even {
+ background-color:#D0D3DD;
+}
+tr.odd {
+ background-color:#E0DFE0;
+}
+tr.inner-even {
+ background-color:#DFE0E9;
+}
+tr.inner-odd {
+ background-color:#EAE9EF;
+}
+</style>
+{% endblock %}
+{% block body %}
+
+<h1>Build Chart</h1>
+
+<table border=1>
+{% for slave,builds in build_chart.data|dictsort %}
+<tr class="{{loop.cycle('even', 'odd')}}">
+ <td>{{ slave }}</td>
+ <td>
+ <table>
+ {% for row in builds %}
+ <tr class="inner-{{loop.cycle('even', 'odd')}}">
+ <td>
+ <div style="display:block;
+ height:25px;
+ width:{{build_chart.max_x + 5}}px;
+ position:relative;">
+ {% for item in row %}
+ <a href="#" title="{{item.build.name}} - {{item.build.number}}">
+ <div class="buildbox"
+ style="background-color:#{{item.color}};
+ width:{{item.width - 1}}px;
+ height:24px;
+ left:{{item.left}}px;
+ display:block;
+ top:0px;"></div></a>
+ {% endfor %}
+ </div>
+ </td>
+ </tr>
+ {% endfor %}
+ </table></td>
+</tr>
+{% endfor %}
+</table>
+
+{% endblock %}
Modified: zorg/trunk/llvmlab/llvmlab/ui/templates/buildbot_monitor.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ui/templates/buildbot_monitor.html?rev=126493&r1=126492&r2=126493&view=diff
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/ui/templates/buildbot_monitor.html (original)
+++ zorg/trunk/llvmlab/llvmlab/ui/templates/buildbot_monitor.html Fri Feb 25 10:45:27 2011
@@ -18,6 +18,7 @@
<th>Result</th>
<th>Start Time</th>
<th>End Time</th>
+ <th>Slave</th>
</tr>
</thead>
{% for build in builds %}
@@ -27,6 +28,7 @@
<td>{{ build.result }}</td>
<td>{{ build.start_time }}</td>
<td>{{ build.end_time }}</td>
+ <td>{{ build.slave }}</td>
</tr>
{% endfor %}
</table>
More information about the llvm-commits
mailing list