[llvm-commits] [LNT] r165445 - in /lnt/trunk/lnt/server: reporting/dailyreport.py ui/templates/reporting/daily_report.html ui/templates/v4_daily_report.html
Daniel Dunbar
daniel at zuster.org
Mon Oct 8 16:02:46 PDT 2012
Author: ddunbar
Date: Mon Oct 8 18:02:46 2012
New Revision: 165445
URL: http://llvm.org/viewvc/llvm-project?rev=165445&view=rev
Log:
lnt.server.ui/dailyreport: Factor out report body into a separate template.
Added:
lnt/trunk/lnt/server/ui/templates/reporting/daily_report.html
Modified:
lnt/trunk/lnt/server/reporting/dailyreport.py
lnt/trunk/lnt/server/ui/templates/v4_daily_report.html
Modified: lnt/trunk/lnt/server/reporting/dailyreport.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/reporting/dailyreport.py?rev=165445&r1=165444&r2=165445&view=diff
==============================================================================
--- lnt/trunk/lnt/server/reporting/dailyreport.py (original)
+++ lnt/trunk/lnt/server/reporting/dailyreport.py Mon Oct 8 18:02:46 2012
@@ -3,6 +3,7 @@
import sqlalchemy.sql
import lnt.server.reporting.analysis
+import lnt.server.ui.app
from lnt.server.ui import util
@@ -162,3 +163,10 @@
if visible_results:
field_results.append((test, visible_results))
self.result_table.append((field, field_results))
+
+ def render(self):
+ env = lnt.server.ui.app.create_jinja_environment()
+ template = env.get_template('reporting/daily_report.html')
+
+ return template.render(
+ report=self, analysis=lnt.server.reporting.analysis)
Added: 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=165445&view=auto
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/reporting/daily_report.html (added)
+++ lnt/trunk/lnt/server/ui/templates/reporting/daily_report.html Mon Oct 8 18:02:46 2012
@@ -0,0 +1,92 @@
+{% if not only_html_body %}
+<html>
+<head>
+ <title>Daily Report: {{
+ '%04d-%02d-%02d' % (report.year, report.month, report.day) }}</title>
+</head>
+<body style="{{ styles['body'] }}">
+{% endif %}
+
+{# Generate the table showing which run orders we are reporting on, for each
+ machine. #}
+<h3 style={{ "styles.h3" }}>Reported Machine Order</h3>
+<table border="1" style="{{ styles.table }}">
+ <thead>
+ <tr>
+ <th style="{{ styles.th }}">Machine Name</th>
+{% for i in range(report.num_prior_days_to_include)|reverse %}
+ <th style="{{ styles.th }}">Day - {{i}}</th>
+{% endfor %}
+ </tr>
+ </thead>
+{% for machine in report.reporting_machines %}
+ <tr>
+ <td style="{{ styles.td }}">{{machine.name}}</td>
+{% for i in range(report.num_prior_days_to_include)|reverse %}
+{% set order = report.prior_days_machine_order_map[i].get(machine) %}
+{% if order %}
+ {# FIXME: Don't hard code field name. #}
+ <td style="{{ styles.td }}">{{order.llvm_project_revision}}</td>
+{% else %}
+ <td style="{{ styles.td }}" bgcolor="#FF0000">N/A</td>
+{% endif %}
+{% endfor %}
+ </tr>
+{% endfor %}
+</table>
+
+{% macro get_cell_value(cr) %}
+{% set test_status = cr.get_test_status() %}
+{% set value_status = cr.get_value_status() %}
+
+{% if (test_status == analysis.REGRESSED or
+ test_status == analysis.UNCHANGED_FAIL) %}
+ <td style="{{ styles.td }}">FAIL</td>
+{% else %}
+
+{% if (value_status == analysis.REGRESSED or
+ value_status == analysis.IMPROVED) %}
+ {{ cr.pct_delta|aspctcell|safe }}
+{% else %}
+ <td style="{{ styles.td }}">-</td>
+{% endif %}
+
+{% endif %}
+{% endmacro %}
+
+{# Generate the table showing the raw sample data. #}
+{% for field,field_results in report.result_table %}
+<h3>Result Table ({{ field.name }})</h3>
+<table border="1" style="{{ styles.table }}">
+ <thead>
+ <tr>
+ <th style="{{ styles.th }}">Test Name</th>
+ <th style="{{ styles.th }}">Machine Name</th>
+{% for i in range(report.num_prior_days_to_include)|reverse %}
+ <th style="{{ styles.th }}">Day - {{i}}</th>
+{% endfor %}
+ </thead>
+{% for test,visible_results in field_results %}
+ <tr>
+ <td style="{{ styles.td }}" colspan="2"> <b>{{test.name}}</b></td>
+ <td style="{{ styles.td }}" colspan="{{report.num_prior_days_to_include}}"> </td>
+ </tr>
+{% for machine,day_results in visible_results %}
+{% set machine_loop = loop %}
+ <tr>
+ <td style="{{ styles.td }}"> </td>
+ <td style="{{ styles.td }}">{{machine.name}}</td>
+ <td style="{{ styles.td }}">{{ day_results[-1].current }}</td>
+{% for day_result in day_results[:-1]|reverse %}
+ {{ get_cell_value(day_result) }}
+{% endfor %}
+ </tr>
+{% endfor %}
+{% endfor %}
+</table>
+{% endfor %}
+
+{% if not only_html_body %}
+</body>
+</html>
+{% endif %}
Modified: lnt/trunk/lnt/server/ui/templates/v4_daily_report.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/v4_daily_report.html?rev=165445&r1=165444&r2=165445&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/v4_daily_report.html (original)
+++ lnt/trunk/lnt/server/ui/templates/v4_daily_report.html Mon Oct 8 18:02:46 2012
@@ -23,83 +23,6 @@
(report.day_start_offset.seconds // 60) % 60,)}})
</center>
-{# Generate the table showing which run orders we are reporting on, for each
- machine. #}
-<h3>Reported Machine Order<h3>
-<table border="1">
- <thead>
- <tr>
- <th>Machine Name</th>
-{% for i in range(report.num_prior_days_to_include)|reverse %}
- <th>Day - {{i}}</th>
-{% endfor %}
- </tr>
- </thead>
-{% for machine in report.reporting_machines %}
- <tr>
- <td>{{machine.name}}</td>
-{% for i in range(report.num_prior_days_to_include)|reverse %}
-{% set order = report.prior_days_machine_order_map[i].get(machine) %}
-{% if order %}
- {# FIXME: Don't hard code field name. #}
- <td>{{order.llvm_project_revision}}</td>
-{% else %}
- <td bgcolor="#FF0000">N/A</td>
-{% endif %}
-{% endfor %}
- </tr>
-{% endfor %}
-</table>
-
-{% macro get_cell_value(cr) %}
-{% set test_status = cr.get_test_status() %}
-{% set value_status = cr.get_value_status() %}
-
-{% if (test_status == analysis.REGRESSED or
- test_status == analysis.UNCHANGED_FAIL) %}
- <td>FAIL</td>
-{% else %}
-
-{% if (value_status == analysis.REGRESSED or
- value_status == analysis.IMPROVED) %}
- {{ cr.pct_delta|aspctcell|safe }}
-{% else %}
- <td>-</td>
-{% endif %}
-
-{% endif %}
-{% endmacro %}
-
-{# Generate the table showing the raw sample data. #}
-{% for field,field_results in report.result_table %}
-<h3>Result Table ({{ field.name }})</h3>
-<table border="1">
- <thead>
- <tr>
- <th>Test Name</th>
- <th>Machine Name</th>
-{% for i in range(report.num_prior_days_to_include)|reverse %}
- <th>Day - {{i}}</th>
-{% endfor %}
- </thead>
-{% for test,visible_results in field_results %}
- <tr>
- <td colspan="2"><b>{{test.name}}</b></td>
- <td colspan="{{report.num_prior_days_to_include}}"> </td>
- </tr>
-{% for machine,day_results in visible_results %}
-{% set machine_loop = loop %}
- <tr>
- <td> </td>
- <td>{{machine.name}}</td>
- <td>{{ day_results[-1].current }}</td>
-{% for day_result in day_results[:-1]|reverse %}
- {{ get_cell_value(day_result) }}
-{% endfor %}
- </tr>
-{% endfor %}
-{% endfor %}
-</table>
-{% endfor %}
+{{ report.render()|safe }}
{% endblock %}
More information about the llvm-commits
mailing list