[llvm-commits] [zorg] r130216 - in /zorg/trunk/lnt/lnt: db/perfdb.py server/ui/templates/simple_overview.html server/ui/templates/test.html server/ui/views.py

Daniel Dunbar daniel at zuster.org
Tue Apr 26 10:48:09 PDT 2011


Author: ddunbar
Date: Tue Apr 26 12:48:09 2011
New Revision: 130216

URL: http://llvm.org/viewvc/llvm-project?rev=130216&view=rev
Log:
LNT/Flask: Port simple overview.

Added:
    zorg/trunk/lnt/lnt/server/ui/templates/simple_overview.html
Modified:
    zorg/trunk/lnt/lnt/db/perfdb.py
    zorg/trunk/lnt/lnt/server/ui/templates/test.html
    zorg/trunk/lnt/lnt/server/ui/views.py

Modified: zorg/trunk/lnt/lnt/db/perfdb.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/db/perfdb.py?rev=130216&r1=130215&r2=130216&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/db/perfdb.py (original)
+++ zorg/trunk/lnt/lnt/db/perfdb.py Tue Apr 26 12:48:09 2011
@@ -89,7 +89,7 @@
 
     id = Column("ID", Integer, primary_key=True)
     run_id = Column("Run", Integer, ForeignKey('Run.ID'))
-    key = Column("Key", String(256))
+    key = Column("Key", String(256), index=True)
     value = Column("Value", String(4096))
 
     def __init__(self, run, key, value):

Added: zorg/trunk/lnt/lnt/server/ui/templates/simple_overview.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/simple_overview.html?rev=130216&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/simple_overview.html (added)
+++ zorg/trunk/lnt/lnt/server/ui/templates/simple_overview.html Tue Apr 26 12:48:09 2011
@@ -0,0 +1,73 @@
+{% set db = request.get_db() %}
+
+{% extends "layout.html" %}
+{% set components = [(tag, db_url_for("simple_overview", tag=tag))] %}
+{% block title %}Overview{% endblock %}
+{% block body %}
+
+{# Find recent runs. #}
+<center><h3>Submission Overview</h3></center>
+<table width="100%%">
+  <tr>
+    <td valign="top" width="50%">
+      <center>
+      <h3>Active Machines</h3>
+      <table class="sortable" border=1>
+        <thead>
+        <tr>
+          <th>Latest Submission</th>
+          <th>Machine</th>
+          <th>Results</th>
+        </tr>
+        </thead>
+
+{# Show the most active machines. #}
+{% for machine_name,r in active_machines|dictsort %}
+      <tr>
+        <td>{{r.start_time}}</td>
+        <td align=left><a href="{{db_url_for('simple_machine',
+                                             tag=tag, id=r.machine.id)}}">{{
+            r.machine.name}}:{{r.machine.number}}</a></td>
+        <td><a href="{{db_url_for('simple_run', tag=tag, id=r.id)}}">
+            View Results</a></td>
+      </tr>
+{% endfor %}
+
+      </table>
+      </center>
+    </td>
+    <td valign="top">
+      <center>
+      <h3>Recent Submissions</h3>
+      <table class="sortable" border=1>
+        <thead>
+        <tr>
+          <th>Run Order</th>
+          <th>Start Time</th>
+          <th>End Time</th>
+          <th>Machine</th>
+          <th>Results</th>
+        </tr>
+        </thead>
+
+{# Show the active submissions. #}
+{% for r,run_order in active_submissions %}
+{% set m = r.machine %}
+      <tr>
+        <td>{{run_order}}</td></td>
+        <td>{{r.start_time}}</td>
+        <td>{{r.end_time}}</td>
+        <td align=left><a href="{{db_url_for('simple_machine',
+                                             tag=tag, id=m.id)}}">{{
+            m.name}}:{{m.number}}</a></td>
+        <td><a href="{{db_url_for('simple_run', tag=tag, id=r.id)}}">
+            View Results</a></td>
+      </tr>
+{% endfor %}
+      </table>
+      </center>
+    </td>
+  </tr>
+</table>
+
+{% endblock %}

Modified: zorg/trunk/lnt/lnt/server/ui/templates/test.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/test.html?rev=130216&r1=130215&r2=130216&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/test.html (original)
+++ zorg/trunk/lnt/lnt/server/ui/templates/test.html Tue Apr 26 12:48:09 2011
@@ -6,7 +6,6 @@
 {% block title %}Test: {{test.name}}{% endblock %}
 {% block body %}
 
-
 {# Show the test info dictionary. #}
 <h3>Test Info</h3>
 <table border=1 cellborder=1>

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=130216&r1=130215&r2=130216&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/views.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/views.py Tue Apr 26 12:48:09 2011
@@ -9,6 +9,8 @@
 from flask import request
 from flask import url_for
 
+from lnt.db import perfdb
+
 frontend = flask.Module(__name__)
 
 ###
@@ -94,3 +96,47 @@
 @db_route("/tests/<id>/")
 def test(id):
     return render_template("test.html", id=id)
+
+###
+# Simple LNT Schema Viewer
+
+from lnt.db.perfdb import Machine, Run, RunInfo
+from lnt.db import perfdbsummary
+
+ at db_route("/simple/<tag>")
+def simple_overview(tag):
+    db = request.get_db()
+
+    # Get the most recent runs in this tag, we just arbitrarily limit to looking
+    # at the last 100 submission.
+    recent_runs = db.query(Run).\
+        join(RunInfo).\
+        order_by(Run.start_time.desc()).\
+        filter(RunInfo.key == "tag").\
+        filter(RunInfo.value == tag).limit(100)
+    recent_runs = list(recent_runs)
+    
+    # Compute the active machine list.
+    active_machines = dict((run.machine.name, run)
+                           for run in recent_runs[::-1])
+
+    # Compute the active submission list.
+    N = 30
+    active_run_orders = dict(
+        db.query(RunInfo.run_id, RunInfo.value).\
+            filter(RunInfo.key == "run_order").\
+            filter(RunInfo.run_id.in_(s.id for s in recent_runs[:N])))
+    active_submissions = [(r, active_run_orders.get(r.id))
+                          for r in recent_runs[:N]]
+
+    return render_template("simple_overview.html", tag=tag,
+                           active_machines=active_machines,
+                           active_submissions=active_submissions)
+
+ at db_route("/simple/<tag>/machines/<id>")
+def simple_machine(tag, id):
+    raise NotImplementedError
+
+ at db_route("/simple/<tag>/<id>")
+def simple_run(tag, id):
+    raise NotImplementedError





More information about the llvm-commits mailing list