[LNT] r258302 - Add a "number of test results" table to the daily report page.

Kristof Beyls via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 20 03:05:19 PST 2016


Author: kbeyls
Date: Wed Jan 20 05:05:19 2016
New Revision: 258302

URL: http://llvm.org/viewvc/llvm-project?rev=258302&view=rev
Log:
Add a "number of test results" table to the daily report page.

This adds a table on the daily report page which reports for each
machine how many tests were seen on a given day. This helps to quickly
notice when a certain machine started producing fewer test/benchmark
results for some reason.

Differential Revision: http://reviews.llvm.org/D16318


Modified:
    lnt/trunk/lnt/server/reporting/analysis.py
    lnt/trunk/lnt/server/reporting/dailyreport.py
    lnt/trunk/lnt/server/ui/templates/reporting/daily_report.html
    lnt/trunk/tests/server/ui/V4Pages.py

Modified: lnt/trunk/lnt/server/reporting/analysis.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/reporting/analysis.py?rev=258302&r1=258301&r2=258302&view=diff
==============================================================================
--- lnt/trunk/lnt/server/reporting/analysis.py (original)
+++ lnt/trunk/lnt/server/reporting/analysis.py Wed Jan 20 05:05:19 2016
@@ -273,7 +273,7 @@ class RunInfo(object):
             compare_to = []
         return self.get_comparison_result([run], compare_to, test_id, field)
 
-    def get_samples(self, runs, test_id, field):
+    def get_samples(self, runs, test_id):
         all_samples = []
         for run in runs:
             samples = self.sample_map.get((run.id, test_id))
@@ -287,8 +287,8 @@ class RunInfo(object):
 
         # Load the sample data for the current and previous runs and the
         # comparison window.
-        run_samples = self.get_samples(runs, test_id, field)
-        prev_samples = self.get_samples(compare_runs, test_id, field)
+        run_samples = self.get_samples(runs, test_id)
+        prev_samples = self.get_samples(compare_runs, test_id)
 
         # Determine whether this (test,pset) passed or failed in the current and
         # previous runs.

Modified: lnt/trunk/lnt/server/reporting/dailyreport.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/reporting/dailyreport.py?rev=258302&r1=258301&r2=258302&view=diff
==============================================================================
--- lnt/trunk/lnt/server/reporting/dailyreport.py (original)
+++ lnt/trunk/lnt/server/reporting/dailyreport.py Wed Jan 20 05:05:19 2016
@@ -94,6 +94,7 @@ class DailyReport(object):
         self.reporting_machines = None
         self.reporting_tests = None
         self.result_table = None
+        self.nr_tests_table = None
 
     def get_query_parameters_string(self):
         query_params = [
@@ -283,6 +284,7 @@ class DailyReport(object):
             return (-int(had_failures), -sum_abs_day0_deltas, test.name)
 
         self.result_table = []
+        self.nr_tests_table = []
         for field in self.fields:
             field_results = []
             for test in self.reporting_tests:
@@ -297,7 +299,7 @@ class DailyReport(object):
                     day_has_samples = []
                     for i in range(0, self.num_prior_days_to_include):
                         runs = self.machine_past_runs.get((machine.id, i), ())
-                        samples = sri.get_samples(runs, test.id, field)
+                        samples = sri.get_samples(runs, test.id)
                         day_has_samples.append(len(samples) > 0)
 
                     def find_most_recent_run_with_samples(day_nr):
@@ -346,9 +348,21 @@ class DailyReport(object):
 
             # Order the field results by "priority".
             field_results.sort(key=compute_visible_results_priority)
-
             self.result_table.append((field, field_results))
 
+        for machine in self.reporting_machines:
+            nr_tests_for_machine = []
+            for i in range(0, self.num_prior_days_to_include):
+                # get all runs with the same largest "order" on a given day
+                day_runs = machine_runs.get((machine.id, i), ())
+                nr_tests_seen = 0
+                for test in self.reporting_tests:
+                    samples = sri.get_samples(day_runs, test.id)
+                    if len(samples)>0:
+                        nr_tests_seen += 1
+                nr_tests_for_machine.append(nr_tests_seen)
+            self.nr_tests_table.append((machine, nr_tests_for_machine))
+
     def render(self, ts_url, only_html_body=True):
         # Strip any trailing slash on the testsuite URL.
         if ts_url.endswith('/'):

Modified: lnt/trunk/lnt/server/ui/templates/reporting/daily_report.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/reporting/daily_report.html?rev=258302&r1=258301&r2=258302&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/reporting/daily_report.html (original)
+++ lnt/trunk/lnt/server/ui/templates/reporting/daily_report.html Wed Jan 20 05:05:19 2016
@@ -61,22 +61,24 @@
 {%- endfor %}
     </tr>
   </thead>
+  <tbody>
 {%- for machine in report.reporting_machines %}
-  <tr class="searchable">
-    <td class="machine-name" style="{{ styles.td }}">{{machine.name}}</td>
+    <tr class="searchable">
+      <td class="machine-name" style="{{ styles.td }}">{{machine.name}}</td>
 {%- for i in range(report.num_prior_days_to_include)|reverse %}
 {%-   set key_run = report.get_key_run(machine, i) -%}
 {%-   if key_run -%}
-    {# FIXME: Don't hard code field name. #}
-    <td style="{{ styles.td }}">
-      <a href="{{ ts_url }}/{{ key_run.id }}">{{
-        key_run.order.llvm_project_revision}}</a></td>
+      {# FIXME: Don't hard code field name. #}
+      <td style="{{ styles.td }}">
+        <a href="{{ ts_url }}/{{ key_run.id }}">{{
+          key_run.order.llvm_project_revision}}</a></td>
 {%-   else -%}
-    <td style="{{ styles.td }}; background-color:#FF0000">N/A</td>
+      <td style="{{ styles.td }}; background-color:#FF0000">N/A</td>
 {%-   endif -%}
 {%- endfor %}
-  </tr>
+    </tr>
 {% endfor %}
+  </tbody>
 </table>
 
 {% macro get_initial_cell_value(day_result) %}
@@ -192,9 +194,9 @@
 
 {% for field,field_results in report.result_table|reverse %}
 <h3>Result Table ({{ field.name }})</h3>
-{{ result_header() if not report.for_mail }}
+{{ result_header()+"\n  <tbody>" if not report.for_mail }}
 {%- for test,visible_results in field_results -%}
-{{ result_header() if report.for_mail }}
+{{ result_header()+"\n  <tbody>" if report.for_mail }}
   <tr>
     <td style="{{ styles.td }}" colspan="2"> <b>{{test.name}}</b></td>
     <td style="{{ styles.td }}" colspan="{{report.num_prior_days_to_include + 1}}"> </td>
@@ -223,11 +225,40 @@
     <td>{{ spark_plot(day_results) }}</td>
   </tr>
 {%-  endfor %}
-{{ "</table><p>" if report.for_mail }}
+{{ "</tbody></table><p>" if report.for_mail }}
 {%- endfor %}
-{{ "</table>" if not report.for_mail }}
+{{ "</tbody></table>" if not report.for_mail }}
 {%- endfor -%}
 
+<h3>Number of Tests Seen</h3>
+<table border="1" style="{{ styles.table }}; width: {{
+                            400 + report.num_prior_days_to_include*80}}px;">
+  <thead>
+    <tr>
+      <th style="{{ styles.th }}; width: 300px;">Machine Name</th>
+    {% for i in range(report.num_prior_days_to_include)|reverse %}
+      <th style="{{ styles.th }}">Day - {{i}}</th>
+    {% endfor %}
+    </tr>
+  </thead>
+  <tbody>
+  {% for machine, nr_tests_for_machine in report.nr_tests_table %}
+  <tr class="searchable">
+    <td class="machine-name" style="{{ styles.td }}">{{machine.name}}</td>
+    {% set nr_tests_prev = None %}
+    {% for nr_tests in nr_tests_for_machine|reverse %}
+        <td style="{{ styles.td }}"
+        {%- if nr_tests_prev is not none and nr_tests_prev != nr_tests %}
+            bgcolor="#dfaf5f"
+        {% endif -%}
+            >{{nr_tests}}</td>
+        {% set nr_tests_prev = nr_tests %}
+    {% endfor %}
+  </tr>
+  {% endfor %}
+  </tbody>
+</table>
+
 {% endif %}
 
 {% if not only_html_body %}

Modified: lnt/trunk/tests/server/ui/V4Pages.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/ui/V4Pages.py?rev=258302&r1=258301&r2=258302&view=diff
==============================================================================
--- lnt/trunk/tests/server/ui/V4Pages.py (original)
+++ lnt/trunk/tests/server/ui/V4Pages.py Wed Jan 20 05:05:19 2016
@@ -96,7 +96,7 @@ def check_nr_machines_reported(client, u
     if reported_machine_order_table is None:
         nr_machines = 0
     else:
-        nr_machines = len(reported_machine_order_table.findall("./tr"))
+        nr_machines = len(reported_machine_order_table.findall("./tbody/tr"))
     assert expected_nr_machines == nr_machines
 
 
@@ -104,39 +104,51 @@ def convert_html_to_text(element):
     return ("".join(element.itertext()))
 
 
-def get_results_table(client, url, fieldname):
+def get_table_by_header(client, url, table_header):
     resp = check_code(client, url)
     html = resp.data
     tree = get_xml_tree(html)
-    table_header = "Result Table (%s)" % fieldname
     table = find_table_with_heading(tree, table_header)
     assert table is not None, \
         "Couldn't find table with header '%s'" % table_header
     return table
 
 
-def check_body_result_table(client, url, fieldname,
-                            expected_table_body_content):
-    table = get_results_table(client, url, fieldname)
+def get_results_table(client, url, fieldname):
+    table_header = "Result Table (%s)" % fieldname
+    return get_table_by_header(client, url, table_header)
+
+
+def check_table_content(table, expected_content):
     body_content = [[convert_html_to_text(cell).strip()
                      for cell in row.findall("./td")]
-                    for row in table.findall("./tr")]
-    assert expected_table_body_content == body_content, \
+                    for row in table.findall("./tbody/tr")]
+    assert expected_content == body_content, \
         "Expected table content %s, found %s" % \
-        (expected_table_body_content, body_content)
+        (expected_content, body_content)
+
+
+def check_body_result_table(client, url, fieldname, expected_content):
+    table = get_results_table(client, url, fieldname)
+    check_table_content(table, expected_content)
+
+
+def check_body_nr_tests_table(client, url, expected_content):
+    table_header = "Number of Tests Seen"
+    table = get_table_by_header(client, url, table_header)
+    check_table_content(table, expected_content)
 
 
 def get_sparkline(client, url, fieldname, testname, machinename):
     table = get_results_table(client, url, fieldname)
     body_content = [[cell
                      for cell in row.findall("./td")]
-                    for row in table.findall("./tr")]
+                    for row in table.findall("./tbody/tr")]
     txt_body_content = [[convert_html_to_text(cell).strip()
                          for cell in row.findall("./td")]
-                        for row in table.findall("./tr")]
+                        for row in table.findall("./tbody/tr")]
     cur_test_name = ""
     for rownr, row_content in enumerate(txt_body_content):
-        nr_columns = len(row_content)
         for colnr, col_content in enumerate(row_content):
             if colnr == 0 and col_content != "":
                 cur_test_name = col_content
@@ -285,6 +297,13 @@ def main():
     assert 2 == nr_sample_points, \
         "Expected 2 sample points, found %d" % nr_sample_points
 
+    check_body_nr_tests_table(
+        client, '/v4/nts/daily_report/2012/5/04',
+        [['machine2', '2', '0', '1']])
+
+
+
+
     # Now check the compile report
     # Get the V4 overview page.
     check_code(client, '/v4/compile/')




More information about the llvm-commits mailing list