[llvm-commits] [LNT] r163779 - in /lnt/trunk: lnt/server/ui/filters.py lnt/server/ui/templates/reporting/ lnt/server/ui/templates/reporting/runs.html lnt/server/ui/templates/reporting/runs.txt setup.py

Michael Gottesman mgottesman at apple.com
Thu Sep 13 00:00:38 PDT 2012


Author: mgottesman
Date: Thu Sep 13 02:00:38 2012
New Revision: 163779

URL: http://llvm.org/viewvc/llvm-project?rev=163779&view=rev
Log:
[LNT] Added initial versions of server/reporting/runs.py
templates for both html and txt output formats.

Additionally:

1. Updated setup.py to ensure that said templates are copied
into any build dist/eggs.

2. Added filter urlencode to lnt.server.ui.filters. This is just a
filter wrapper around urllib.urlencode.

3. Added filter format_or_default to lnt.server.ui.filters. This is just
a formatting filter which takes in 3 arguments, a format, a tuple of
args, and a default value. If the tuple is not None, then the filter
returns format % tuple. If tuple is None, the filter returns default. I
used this to refactor out formatting like format_or_default('%s - %s',
args, '-') so that a '-' will be used if args is None.

Added:
    lnt/trunk/lnt/server/ui/templates/reporting/
    lnt/trunk/lnt/server/ui/templates/reporting/runs.html
    lnt/trunk/lnt/server/ui/templates/reporting/runs.txt
Modified:
    lnt/trunk/lnt/server/ui/filters.py
    lnt/trunk/setup.py

Modified: lnt/trunk/lnt/server/ui/filters.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/filters.py?rev=163779&r1=163778&r2=163779&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/filters.py (original)
+++ lnt/trunk/lnt/server/ui/filters.py Thu Sep 13 02:00:38 2012
@@ -1,6 +1,8 @@
 import StringIO
 import datetime
 import pprint
+import urllib
+import time
 
 from lnt.server.ui import util
 
@@ -18,6 +20,18 @@
     pprint.pprint(value, stream)
     return stream.getvalue()
 
+def filter_format_or_default(fmt, input, default):
+    if input:
+        return fmt % input
+    else:
+        return default
+
+def filter_urlencode(args):
+    return urllib.urlencode(args)
+
+def filter_timedelta(start_time):
+    return "%.2fs" % (time.time() - start_time)
+
 def register(app):
     for name,object in globals().items():
         if name.startswith('filter_'):

Added: lnt/trunk/lnt/server/ui/templates/reporting/runs.html
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/reporting/runs.html?rev=163779&view=auto
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/reporting/runs.html (added)
+++ lnt/trunk/lnt/server/ui/templates/reporting/runs.html Thu Sep 13 02:00:38 2012
@@ -0,0 +1,166 @@
+
+{% import "v4_utils.html" as v4_utils %}
+{% import "utils.html" as utils %}
+
+{#
+  Macro for rendering the report for either a run-to-run display or a run-to-baseline display.
+#}
+{%
+  macro add_report_changes_detail_for_field_and_bucket(
+    field, show_perf, run_url, field_index, field_display_name, bucket_name, bucket, test_names,
+    primary_name, primary_field_suffix, secondary_field_suffix, secondary_info, styles
+  )
+%}
+
+{% if bucket and bucket_name != 'Unchanged Tests' %}
+   <p>
+     <table style="{{ styles['table'] }}" class="sortable">
+       <tr>
+         <th style="{{ styles['th'] }}" width="500">{{ bucket_name }} - {{ field_display_name }}</th>
+       {% if not show_perf %}
+         {% for name in test_names %}
+           <tr><td style="{{ styles['td'] }}">{{ name }}</td></tr>
+         {% endfor %}
+       {% else %}
+         <th style="{{ styles['th'] }}">Δ {{ primary_field_suffix }}</th>
+         <th style="{{ styles['th'] }}">{{ primary_name }}</th>
+         <th style="{{ styles['th'] }}">Current</th>
+         <th style="{{ styles['th'] }}">σ {{ primary_field_suffix }}</th>
+         {% if secondary_info %}
+         <th style="{{ styles['th'] }}">Δ {{ secondary_field_suffix }}</th>           
+         <th style="{{ styles['th'] }}">σ {{ secondary_field_suffix }}</th>
+         {% endif %}
+         </tr>
+         
+         {% for name, cr, test_id in bucket %}
+         <tr>
+           <td style="{{ styles['td'] }}">
+             <a href="{{ run_url }}/graph?{{ [('test.%d' % test_id, field_index)] | urlencode }}">{{ name }}</a>
+           </td>
+           {{ cr.pct_delta|aspctcell(style=styles['td'])|safe }}
+           <td style="{{ styles['td'] }}">{{ "%.4f" | format(cr.previous) }}</td>
+           <td style="{{ styles['td'] }}">{{ "%.4f" | format(cr.current) }}</td>
+           <td style="{{ styles['td'] }}">{{ "%.4f" | format_or_default(cr.stddev, '-') }}</td>
+           {% if secondary_info %}
+             {% set a_cr = secondary_info[(name, field)] %}
+             {{ a_cr.pct_delta|aspctcell(style=styles['td'])|safe }}
+             <td style="{{ styles['td'] }}">{{ "%.4f" | format_or_default(a_cr.stddev, '-') }}</td>
+           {% endif %}
+         </tr>
+         {% endfor %}
+       {% endif %}
+     </table>
+{% endif %}
+{% endmacro %}
+
+{% if not only_html_body %}
+<html>
+<head>
+   <title>{{ subject }}</title>
+</head>
+<body style="{{ styles['body'] }}">
+{% endif %}
+
+<h1 style="{{ styles['h1'] }}">
+  <a href="{{ report_url }}">{{ subject }}</a>
+</h1>
+
+<p>
+<table style="{{ styles['table'] }}">
+  <thead>
+    <tr>
+      <th style="{{ styles['th'] }}">Run</th>
+      <th style="{{ styles['th'] }}">Order</th>
+      <th style="{{ styles['th'] }}">Start Time</th>
+      <th style="{{ styles['th'] }}">Duration</th>
+    </tr>
+  </thead>
+  {% for title, r in (('Current', run), ('Previous', compare_to), ('Baseline', baseline)) %}
+    {% if r %}
+    <tr>
+      <td style="{{ styles['td'] }}"><a href="{{ ts_url }}/{{ r.id }}">{{ title }}</a></td>
+      <td style="{{ styles['td'] }}"><a href="{{ ts_url }}/order/{{ r.order.id }}">{{ r.order.llvm_project_revision }}</a></td>
+      <td style="{{ styles['td'] }}">{{ r.start_time }}</td>
+      <td style="{{ styles['td'] }}">{{ r.end_time - r.start_time }}</td>
+    </tr>
+    {% else %}
+      <tr><td style="{{ styles['td'] }}" colspan=4>No {{ title }} Run</td></tr>
+    {% endif %}
+  {% endfor %}
+</table>
+
+{% if compare_to and run.machine != compare_to.machine %}
+<p><b>
+*** WARNING ***: comparison is against a different machine ({{compare_to.machine.name}},{{compare_to.machine.id}})
+</b></p>
+{% endif %}
+{% if baseline and run.machine != baseline.machine %}
+<p><b>
+*** WARNING ***: baseline is against a different machine ({{baseline.machine.name}},{{baseline.machine.id}})
+</b></p>
+{% endif %}
+
+<hr>
+<h3>Tests Summary</h3>
+<table style="{{ styles['table'] }}">
+  <thead>
+    <tr>
+      <th style="{{ styles['th'] }}">Status Group</th>
+      <th style="{{ styles['th'] }}" align="right">#</th>
+      {% if baseline %}
+        <th style="{{ styles['th'] }}" align="right"># (B)</th>
+      {% endif %}
+    </tr>
+  </thead>
+  
+  {% for i, name, num_items, num_items_vs_baseline in num_item_buckets %}
+    {% if num_items or num_items_vs_baseline %}
+      <tr>
+        <td style="{{ styles['td'] }}">{{ name }}</td>
+        <td style="{{ styles['td'] }}" align="right">{{ num_items }}</td>
+        {% if baseline %}
+        <td style="{{ styles['td'] }}" align="right">{{ num_items_vs_baseline }}</td>
+        {% endif %}
+      </tr>
+    {% endif %}                
+  {% endfor %}
+  
+  <tfoot>
+    <tr>
+      <td style="{{ styles['td'] }}"><b>Total Tests</b></td>
+      <td style="{{ styles['td'] }}" align="right"><b>{{ num_total_tests }}</b></td>
+    </tr>
+  </tfoot>
+</table>
+
+<p>
+<h3>Run-Over-Run Changes Detail</h3>
+{% for _, field, bucket_name, sorted_bucket, test_names, show_perf in prioritized_buckets_run_over_run %}
+  {% set field_index = ts.sample_fields.index(field) %}
+  {% set field_display_name = {"compile_time":"Compile Time",
+                               "execution_time":"Execution Time"}.get(field.name, field.name) %}
+  {{
+    add_report_changes_detail_for_field_and_bucket(field, show_perf, run_url, field_index, field_display_name,
+                                                   bucket_name, sorted_bucket, test_names,
+                                                   'Previous', '', ' (B)', run_to_baseline_info, styles)
+  }}
+{% endfor %}
+<p>
+<h3>Run-Over-Baseline Changes Detail</h3>
+{% for _, field, bucket_name, sorted_bucket, test_names, show_perf in prioritized_buckets_run_over_baseline %}
+  {% set field_index = ts.sample_fields.index(field) %}
+  {% set field_display_name = {"compile_time":"Compile Time",
+                               "execution_time":"Execution Time"}.get(field.name, field.name) %}
+  {{
+    add_report_changes_detail_for_field_and_bucket(field, show_perf, run_url, field_index, field_display_name,
+                                                   bucket_name, sorted_bucket, test_names,
+                                                   'Baseline', '(B)', '', run_to_run_info, styles)
+  }}
+{% endfor %}
+<hr/>
+<b>Report Time</b>: {{ start_time | timedelta }}
+{% if not only_html_body %}
+</body>
+</html>
+{% endif %}
+

Added: lnt/trunk/lnt/server/ui/templates/reporting/runs.txt
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/templates/reporting/runs.txt?rev=163779&view=auto
==============================================================================
--- lnt/trunk/lnt/server/ui/templates/reporting/runs.txt (added)
+++ lnt/trunk/lnt/server/ui/templates/reporting/runs.txt Thu Sep 13 02:00:38 2012
@@ -0,0 +1,77 @@
+{%- macro add_report_changes_detail_for_field_and_bucket(show_perf, field_display_name, bucket_name, bucket, test_names) -%}
+{%- if bucket and bucket_name != 'Unchanged Tests' %}
+
+{{ bucket_name }} - {{ field_display_name }}
+{{ '-' * (bucket_name.__len__() + field_display_name.__len__() + 3) }}
+{%- if not show_perf %}
+  {%- for name in test_names %}
+  {{ name }}
+  {%- endfor %}
+{%- endif %}
+{%- for name, cr, test_id in bucket -%}
+{% if cr.previous is not none and cr.current is not none %}
+  {{ name }}: {{ "%.2f%%" | format_or_default(cr.pct_delta and cr.pct_delta*100, '-')}} {{ "(%.4f => %.4f" | format(cr.previous, cr.current) }}{{ ", std.dev.: %.4f)" | format_or_default(cr.stddev, ")")}}
+{%- endif %}
+{%- endfor %}
+
+{%- endif %}
+{%- endmacro -%}
+
+{{ report_url }}
+Nickname: {{ machine.name }}:{{ machine.id }}
+{% if 'name' in machine_parameters -%}
+{{ "Name: %s" | format(machine_parameters['name']) }}
+{%- endif %}
+Comparing:
+     Run: {{ run.id }}, Order: {{ run.order.llvm_project_revision }}, Start Time: {{ run.start_time }}, End Time: {{ run.end_time }}
+{%- if compare_to %}
+      To: {{ compare_to.id }}, Order: {{ compare_to.order.llvm_project_revision }}, Start Time: {{ compare_to.start_time }}, End Time: {{ compare_to.end_time }}
+     {%- if run.machine != compare_to.machine %}
+*** WARNING ***:
+comparision is against a different machine
+({{ compare_to.machine.name }}:{{ compare_to.machine.id }})        
+     {%- endif %}
+{%- else %}
+      To: (none)
+{%- endif %}
+{%- if baseline %}
+Baseline: {{ baseline.id }}, Order: {{ baseline.order.llvm_project_revision }}, Start Time: {{ baseline.start_time }}, End Time: {{ baseline.end_time }}
+{%- endif %}
+
+===============
+Tests Summary
+===============
+{% for i, name, num_items, num_items_vs_baseline in num_item_buckets -%}
+  {%- if num_items or num_items_vs_baseline %}
+     {%- if baseline %}
+{{ name }}: {{ num_items }} ({{ num_items_vs_baseline }} on baseline)
+     {%- else %}
+{{ name }}: {{ num_items }}
+     {%- endif %}
+  {%- endif %}                
+{%- endfor %}
+Total Tests: {{ num_total_tests }}
+
+===========================
+Run-Over-Run Changes Detail
+===========================
+{%- for _, field, bucket_name, sorted_bucket, test_names, show_perf in prioritized_buckets_run_over_run %}
+  {%- set field_display_name = {"compile_time":"Compile Time", "execution_time":"Execution Time"}.get(field.name, field.name) -%}
+  {{ add_report_changes_detail_for_field_and_bucket(show_perf, field_display_name, bucket_name, sorted_bucket, test_names) }}
+{%- endfor %}
+{%- if baseline %}
+
+================================
+Run-Over-Baseline Changes Detail
+================================
+{%- for _, field, bucket_name, sorted_bucket, test_names, show_perf in prioritized_buckets_run_over_baseline -%}
+  {%- set field_display_name = {"compile_time":"Compile Time",
+                               "execution_time":"Execution Time"}.get(field.name, field.name) -%}
+  {{
+    add_report_changes_detail_for_field_and_bucket(show_perf, field_display_name,
+                                                           bucket_name, sorted_bucket, test_names)
+  }}
+{%- endfor %}
+{%- endif %}
+
+Report Time: {{ start_time | timedelta }}

Modified: lnt/trunk/setup.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/setup.py?rev=163779&r1=163778&r2=163779&view=diff
==============================================================================
--- lnt/trunk/setup.py (original)
+++ lnt/trunk/setup.py Thu Sep 13 02:00:38 2012
@@ -72,7 +72,9 @@
                                       'static/*.css',
                                       'static/flot/*.min.js',
                                       'static/jquery/**/*.min.js',
-                                      'templates/*.html'],
+                                      'templates/*.html',
+                                      'templates/reporting/*.html',
+                                      'templates/reporting/*.txt'],
                     'lnt.server.db': ['migrations/*.py'] },
 
     packages = find_packages(),





More information about the llvm-commits mailing list