[LNT] r263600 - Fix problems in legend packing which caused baselines to fail

Chris Matthews via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 15 15:41:14 PDT 2016


Author: cmatthews
Date: Tue Mar 15 17:41:14 2016
New Revision: 263600

URL: http://llvm.org/viewvc/llvm-project?rev=263600&view=rev
Log:
Fix problems in legend packing which caused baselines to fail

Modified:
    lnt/trunk/lnt/server/ui/templates/v4_graph.html
    lnt/trunk/lnt/server/ui/views.py
    lnt/trunk/tests/server/ui/V4Pages.py

Modified: lnt/trunk/lnt/server/ui/templates/v4_graph.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/v4_graph.html?rev=263600&r1=263599&r2=263600&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/v4_graph.html (original)
+++ lnt/trunk/lnt/server/ui/templates/v4_graph.html Tue Mar 15 17:41:14 2016
@@ -270,7 +270,7 @@ function init_page() {
       <th>Test</th>
       <th>Type</th>
     </tr>
-    {% for machine,test_name,field_name,col, url in legend %}
+    {% for machine, test_name, field_name, col, url in legend %}
     <tr class="data-row" data-url="{{url}}">
       <td style="background-color: #{{ '%02x%02x%02x' % (255*col[0], 255*col[1], 255*col[2]) }}"> </td>
       <td>{{ utils.render_machine(machine) }}</td>

Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=263600&r1=263599&r2=263600&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Tue Mar 15 17:41:14 2016
@@ -469,6 +469,7 @@ def v4_run_graph(id):
     return redirect(v4_url_for("v4_graph", **args))
 
 BaselineLegendItem = namedtuple('BaselineLegendItem', 'name id')
+LegendItem = namedtuple('LegendItem', 'machine test_name field_name color url')
 
 @v4_route("/graph")
 def v4_graph():
@@ -632,7 +633,7 @@ def v4_graph():
         # Determine the base plot color.
         col = list(util.makeDarkColor(float(i) / num_plots))
         url = "/".join([str(machine.id), str(test.id), str(field_index)])
-        legend.append((machine, test.name, field.name, tuple(col), url))
+        legend.append(LegendItem(machine, test.name, field.name, tuple(col), url))
 
         # Load all the field values for this test on the same machine.
         #
@@ -685,7 +686,7 @@ def v4_graph():
                                    'yaxis': {'from': mean, 'to': mean},
                                    'name': q_baseline[0].llvm_project_revision})
             baseline_name = "Baseline {} on {}".format(baseline_title,  q_baseline[0].name)
-            legend.append((BaselineLegendItem(baseline_name, baseline.id), test.name, field.name, dark_col))
+            legend.append(LegendItem(BaselineLegendItem(baseline_name, baseline.id), test.name, field.name, dark_col, None))
 
     # Draw mean trend if requested.
     if mean_parameter:
@@ -693,7 +694,7 @@ def v4_graph():
         test_name = 'Geometric Mean'
 
         col = (0,0,0)
-        legend.append((machine, test_name, field.name, col, None))
+        legend.append(LegendItem(machine, test_name, field.name, col, None))
 
         q = ts.query(sqlalchemy.sql.func.min(field.column),
                 ts.Order.llvm_project_revision,
@@ -904,13 +905,13 @@ def v4_graph():
         json_obj['data'] = graph_plots
         # Flatten ORM machine objects to their string names.
         simple_type_legend = []
-        for machine, test, unit, color, url in legend:
+        for li in legend:
             # Flatten name, make color a dict.
-            new_entry = {'name': machine.name,
-                         'test': test,
-                         'unit': unit,
-                         'color': util.toColorString(color),
-                         'url': url}
+            new_entry = {'name': li.machine.name,
+                         'test': li.test_name,
+                         'unit': li.field_name,
+                         'color': util.toColorString(li.color),
+                         'url': li.url}
             simple_type_legend.append(new_entry)
         json_obj['legend'] = simple_type_legend
         json_obj['revision_range'] = revision_range

Modified: lnt/trunk/tests/server/ui/V4Pages.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/ui/V4Pages.py?rev=263600&r1=263599&r2=263600&view=diff
==============================================================================
--- lnt/trunk/tests/server/ui/V4Pages.py (original)
+++ lnt/trunk/tests/server/ui/V4Pages.py Tue Mar 15 17:41:14 2016
@@ -265,7 +265,9 @@ def main():
                expected_code=HTTP_NOT_FOUND)
     check_code(client, '/v4/nts/graph?mean=1.9999',
                expected_code=HTTP_NOT_FOUND)
-
+    #  Check baselines work.
+    check_code(client, '/v4/nts/graph?plot.0=1.3.2&baseline.60=3')
+    
     # Check some variations of the daily report work.
     check_code(client, '/v4/nts/daily_report/2012/4/12')
     check_code(client, '/v4/nts/daily_report/2012/4/11')




More information about the llvm-commits mailing list