[llvm-commits] [zorg] r147082 - in /zorg/trunk/lnt/lnt/server/ui: templates/v4_machine.html templates/v4_run.html templates/v4_utils.html views.py

Daniel Dunbar daniel at zuster.org
Wed Dec 21 12:00:29 PST 2011


Author: ddunbar
Date: Wed Dec 21 14:00:28 2011
New Revision: 147082

URL: http://llvm.org/viewvc/llvm-project?rev=147082&view=rev
Log:
[lnt/v0.4] lnt.server.ui/v4: Start work on Run UI.
 - So far, only implements the basic page structure and browsing to adjacent runs.
 - For now, not really trying to improve the UI, just get to feature parity with V3 stuff.

Added:
    zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html
    zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html
Modified:
    zorg/trunk/lnt/lnt/server/ui/templates/v4_machine.html
    zorg/trunk/lnt/lnt/server/ui/views.py

Modified: zorg/trunk/lnt/lnt/server/ui/templates/v4_machine.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/v4_machine.html?rev=147082&r1=147081&r2=147082&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/v4_machine.html (original)
+++ zorg/trunk/lnt/lnt/server/ui/templates/v4_machine.html Wed Dec 21 14:00:28 2011
@@ -41,6 +41,9 @@
 {{ utils.render_popup_begin('machine_info', 'Machine Info', true, 1) }}
       <h4>Fields</h4>
       <table border=1>
+      <thead>
+        <tr><th>Name</th><th>Value</th></tr>
+      </thead>
 {% for item in ts.machine_fields %}
       <tr>
         <td> <b>{{item.name}}</b> </td>
@@ -50,6 +53,9 @@
       </table>
       <h4>Parameters</h4>
       <table border=1>
+      <thead>
+        <tr><th>Name</th><th>Value</th></tr>
+      </thead>
 {% for key,value in machine.parameters|dictsort %}
       <tr>
         <td> <b>{{key}}</b> </td>

Added: zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html?rev=147082&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html (added)
+++ zorg/trunk/lnt/lnt/server/ui/templates/v4_run.html Wed Dec 21 14:00:28 2011
@@ -0,0 +1,86 @@
+{% import "v4_utils.html" as v4_utils %}
+{% import "utils.html" as utils %}
+
+{% set machine = run.machine %}
+
+{% extends "layout.html" %}
+{% set components = [(ts.name, v4_url_for("v4_overview")),
+                     ('machine', v4_url_for("v4_machine", id=machine.id))] %}
+{% block head %}
+        <script src="{{ url_for('.static', filename='popup.js') }}"></script>
+        <script src="{{ url_for('.static', filename='sorttable.js') }}"></script>
+        <script src="{{ url_for('.static', filename='View2D.js') }}"></script>
+{% endblock %}
+
+{% block title %}Run Results{% endblock %}
+
+{% block body %}
+
+{% call v4_utils.v4_run_page(ts, machine, run, compare_to, neighboring_runs) %}
+
+{{ utils.render_popup_begin('view_options', 'View Options', true) }}
+<form action="" method="get">
+<b>Show Delta:</b>
+<input type="checkbox" name="show_delta" value="yes" {{
+       "checked" if options.show_delta }}><br>
+
+<b>Show Previous Value:</b>
+<input type="checkbox" name="show_previous" value="yes" {{
+       "checked" if options.show_previous }}><br>
+
+<b>Show Standard Deviation:</b>
+<input type="checkbox" name="show_stddev" value="yes" {{
+       "checked" if options.show_stddev }}><br>
+
+<b>Show Median Absolute Deviation:</b>
+<input type="checkbox" name="show_mad" value="yes" {{
+       "checked" if options.show_mad }}><br>
+
+<b>Show All Values:</b>
+<input type="checkbox" name="show_all" value="yes" {{
+       "checked" if options.show_all }}><br>
+
+<b>Show All Samples:</b>
+<input type="checkbox" name="show_all_samples" value="yes" {{
+       "checked" if options.show_all_samples }}><br>
+
+<b>Show Sample Counts:</b>
+<input type="checkbox" name="show_sample_counts" value="yes" {{
+       "checked" if options.show_sample_counts }}><br>
+
+<b>Number of Comparison Runs:</b>
+<input type="text" name="num_comparison_runs" value="{{
+       options.num_comparison_runs }}"><br>
+
+<b>Show Report Graphs:</b>
+<input type="checkbox" name="show_graphs" value="yes" {{
+       "checked" if options.show_graphs }}><br>
+
+<b>Show Data Table:</b>
+<input type="checkbox" name="show_data_table" value="yes" {{
+       "checked" if options.show_data_table }}><br>
+
+<b>Hide Report By Default:</b>
+<input type="checkbox" name="hide_report_by_default" value="yes" {{
+       "checked" if options.hide_report_by_default }}><br>
+
+<b>Test Filter (regexp):</b>
+<input type="text" name="test_filter" value="{{
+       options.test_filter }}"><br>
+
+<input type="submit" name="submit" value="Update">
+</form>
+{{ utils.render_popup_end() }}
+
+{{ utils.render_popup_begin('text_report', 'Report (Text)', true) }}
+<pre>{{ text_report }}</pre>
+{{ utils.render_popup_end() }}
+
+{{ utils.render_popup_begin('html_report', 'Report (HTML)',
+                            options.hide_report_by_default) }}
+{{html_report|safe}}
+{{ utils.render_popup_end() }}
+
+{% endcall %}
+
+{% endblock %}

Added: zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html?rev=147082&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html (added)
+++ zorg/trunk/lnt/lnt/server/ui/templates/v4_utils.html Wed Dec 21 14:00:28 2011
@@ -0,0 +1,113 @@
+{% import "utils.html" as utils %}
+
+{% macro v4_run_page(ts, machine, run, compare_to, neighboring_runs) %}
+
+<center>
+  <table>
+    <tr>
+      <td align=right>Machine:</td>
+      <td>{{machine.name}}:{{machine.id}}</td>
+    </tr>
+    <tr>
+      <td align=right>Run:</td>
+{# FIXME: Don't hard code field name. #}
+      <td>{{run.start_time}} ({{
+        run.order.llvm_project_revision}})</td>
+    </tr>
+{% if compare_to %}
+    <tr>
+      <td align=right>Compare To:</td>
+{# FIXME: Don't hard code field name. #}
+      <td>{{compare_to.start_time}} ({{
+        compare_to.order.llvm_project_revision}})</td>
+    </tr>
+{% endif %}
+  </table>
+</center>
+<p>
+
+<table width="100%%" border=1>
+  <tr>
+    <td valign="top" width="200">
+      <a href="..">Homepage</a>
+      <h4>Machine:</h4>
+      <a href="{{ v4_url_for('v4_machine', id=machine.id) }}">{{
+        machine.name}}:{{machine.id}}</a>
+      <h4>Runs:</h4>
+      <ul>
+
+{# Show a small number of neighboring runs. #}
+{% for r in neighboring_runs %}
+        <li>{{ "<h3>"|safe if r.id == run.id }}
+            <a href="{{v4_url_for('v4_run', id=r.id)}}">{{
+                     r.start_time}}</a>{{
+            "</h3>"|safe if r.id == run.id }}
+{% endfor %}
+      </ul>
+    </td>
+    <td valign="top">
+      <table border=1>
+      <tr>
+        <td> <b>Nickname</b> </td>
+        <td> {{machine.name}} </td>
+      </tr>
+      <tr>
+        <td> <b>Machine ID</b> </td>
+        <td> {{machine.id}} </td>
+      </tr>
+      </table>
+{{ utils.render_popup_begin('machine_info', 'Machine Info', true) }}
+      <h4>Fields</h4>
+      <table border=1>
+{% for item in machine.fields %}
+      <tr>
+        <td> <b>{{item.name}}</b> </td>
+        <td>{{machine.get_field(item)}}</td>
+      </tr>
+{% endfor %}
+      </table>
+      <h4>Parameters</h4>
+      <table border=1>
+{% for key,value in machine.parameters|dictsort %}
+      <tr>
+        <td> <b>{{key}}</b> </td>
+        <td>{{value}}</td>
+      </tr>
+{% endfor %}
+      </table>
+{{ utils.render_popup_end() }}
+
+{{ utils.render_popup_begin('run_info', 'Run Info', true) }}
+      <h4>Fields</h4>
+      <table border=1>
+      <thead>
+        <tr><th>Name</th><th>Value</th></tr>
+      </thead>
+{% for item in run.fields %}
+      <tr>
+        <td> <b>{{item.name}}</b> </td>
+        <td>{{run.get_field(item)}}</td>
+      </tr>
+{% endfor %}
+      </table>
+
+      <h4>Parameters</h4>
+      <table border=1>
+      <thead>
+        <tr><th>Name</th><th>Value</th></tr>
+      </thead>
+{% for key,value in run.parameters|dictsort %}
+      <tr>
+        <td> <b>{{key}}</b> </td>
+        <td>{{value}}</td>
+      </tr>
+{% endfor %}
+      </table>
+{{ utils.render_popup_end() }}
+{{ caller() }}
+
+    </td>
+  </tr>
+</table>
+
+{% endmacro %}

Modified: zorg/trunk/lnt/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/views.py?rev=147082&r1=147081&r2=147082&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/views.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/views.py Wed Dec 21 14:00:28 2011
@@ -637,9 +637,72 @@
                            testsuite_name=g.testsuite_name, id=id,
                            associated_runs=associated_runs)
 
+def get_adjacent_runs_on_machine(ts, run, N):
+    prev_runs = []
+    ordinal = run.order.ordinal - 1
+    while ordinal >= 0 and (len(prev_runs) < N or
+                           run.order.ordinal - ordinal < N):
+        # Find all the runs on this machine from the previous order.
+        prev_runs.extend(ts.query(ts.Run).\
+                             join(ts.Order).\
+                             filter(ts.Order.ordinal == ordinal).\
+                             filter(ts.Run.machine == run.machine))
+        ordinal = ordinal - 1
+
+    next_runs = []
+    ordinal = run.order.ordinal + 1
+    # FIXME: This probably isn't a great way to limit our search, at least for
+    # SQLite which can't answer this quickly.
+    last_ordinal = ts.query(ts.Order).count()
+    while ordinal != last_ordinal and (len(next_runs) < N or
+                                       ordinal - run.order.ordinal < N):
+        # Find all the runs on this machine from the next order.
+        next_runs.extend(ts.query(ts.Run).\
+            join(ts.Order).\
+            filter(ts.Order.ordinal == ordinal).\
+            filter(ts.Run.machine == run.machine))
+        ordinal = ordinal + 1
+
+    return next_runs[::-1] + [run] + prev_runs
+
 @v4_route("/<int:id>")
 def v4_run(id):
-    return "run %d" % id
+    ts = request.get_testsuite()
+    run = ts.getRun(id)
+
+    # Find the neighboring runs, by order.
+    neighboring_runs = get_adjacent_runs_on_machine(ts, run, N = 3)
+
+    # Parse the view options.
+    options = {}
+    options['show_delta'] = bool(request.args.get('show_delta'))
+    options['show_previous'] = bool(request.args.get('show_previous'))
+    options['show_stddev'] =  bool(request.args.get('show_stddev'))
+    options['show_mad'] = bool(request.args.get('show_mad'))
+    options['show_all'] = bool(request.args.get('show_all'))
+    options['show_all_samples'] = bool(request.args.get('show_all_samples'))
+    options['show_sample_counts'] = bool(request.args.get('show_sample_counts'))
+    options['show_graphs'] = show_graphs = bool(request.args.get('show_graphs'))
+    options['show_data_table'] = bool(request.args.get('show_data_table'))
+    options['hide_report_by_default'] = bool(
+        request.args.get('hide_report_by_default'))
+    try:
+        num_comparison_runs = int(request.args.get('num_comparison_runs'))
+    except:
+        num_comparison_runs = 10
+    options['num_comparison_runs'] = num_comparison_runs
+    options['test_filter'] = test_filter_str = request.args.get(
+        'test_filter', '')
+    if test_filter_str:
+        test_filter_re = re.compile(test_filter_str)
+    else:
+        test_filter_re = None
+
+    # FIXME: Include when we have report functionality.
+    _, text_report, html_report = None, "", ""
+
+    return render_template("v4_run.html", ts=ts, run=run,
+                           options=options, neighboring_runs=neighboring_runs)
 
 @v4_route("/order/<int:ordinal>")
 def v4_order(ordinal):





More information about the llvm-commits mailing list