[llvm-commits] [zorg] r147040 - in /zorg/trunk/lnt/lnt: db/perfdb.py server/db/v4db.py server/ui/app.py server/ui/templates/index.html server/ui/views.py
Daniel Dunbar
daniel at zuster.org
Tue Dec 20 22:22:04 PST 2011
Author: ddunbar
Date: Wed Dec 21 00:22:04 2011
New Revision: 147040
URL: http://llvm.org/viewvc/llvm-project?rev=147040&view=rev
Log:
[lnt/v0.4] lnt.server.ui/index: Start work on UI for V4 databases.
Modified:
zorg/trunk/lnt/lnt/db/perfdb.py
zorg/trunk/lnt/lnt/server/db/v4db.py
zorg/trunk/lnt/lnt/server/ui/app.py
zorg/trunk/lnt/lnt/server/ui/templates/index.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=147040&r1=147039&r2=147040&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/db/perfdb.py (original)
+++ zorg/trunk/lnt/lnt/db/perfdb.py Wed Dec 21 00:22:04 2011
@@ -344,6 +344,10 @@
def importDataFromDict(self, data):
return importDataFromDict(self, data)
+ def get_db_summary(self):
+ import perfdbsummary
+ return perfdbsummary.PerfDBSummary.fromdb(self)
+
def importDataFromDict(db, data):
# FIXME: Validate data
machineData = data['Machine']
Modified: zorg/trunk/lnt/lnt/server/db/v4db.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/db/v4db.py?rev=147040&r1=147039&r2=147040&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/db/v4db.py (original)
+++ zorg/trunk/lnt/lnt/server/db/v4db.py Wed Dec 21 00:22:04 2011
@@ -113,3 +113,23 @@
db = self.testsuite.get(db_name)
return db.importDataFromDict(data)
+
+ def get_db_summary(self):
+ return V4DBSummary(self)
+
+class V4DBSummary(object):
+ class SuiteSummary(object):
+ def __init__(self, name, path):
+ self.name = name
+ self.path = path
+
+ def __init__(self, db):
+ self.db = db
+
+ @property
+ def suites(self):
+ for name in self.db.testsuite:
+ yield V4DBSummary.SuiteSummary(name, ("v4", name))
+
+ def is_up_to_date(self, db):
+ return True
Modified: zorg/trunk/lnt/lnt/server/ui/app.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/app.py?rev=147040&r1=147039&r2=147040&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/app.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/app.py Wed Dec 21 00:22:04 2011
@@ -12,6 +12,7 @@
import lnt.server.config
import lnt.server.ui.filters
import lnt.server.ui.views
+import lnt.server.db.v4db
from lnt.db import perfdbsummary
from lnt.db import perfdb
@@ -41,7 +42,10 @@
def get_db(self):
if self.db is None:
- self.db = perfdb.PerfDB(g.db_info.path)
+ if g.db_info.db_version == '0.3':
+ self.db = perfdb.PerfDB(g.db_info.path)
+ else:
+ self.db = lnt.server.db.v4db.V4DB(g.db_info.path)
# Enable SQL logging with db_log.
#
@@ -110,9 +114,10 @@
old_config=self.old_config)
def get_db_summary(self, db_name, db):
+ # FIXME/v3removal: Eliminate this, V4DB style has no need for summary
+ # abstraction.
db_summary = self.db_summaries.get(db_name)
if db_summary is None or not db_summary.is_up_to_date(db):
- self.db_summaries[db_name] = db_summary = \
- perfdbsummary.PerfDBSummary.fromdb(db)
+ self.db_summaries[db_name] = db_summary = db.get_db_summary()
return db_summary
Modified: zorg/trunk/lnt/lnt/server/ui/templates/index.html
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/ui/templates/index.html?rev=147040&r1=147039&r2=147040&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/templates/index.html (original)
+++ zorg/trunk/lnt/lnt/server/ui/templates/index.html Wed Dec 21 00:22:04 2011
@@ -5,12 +5,12 @@
{# Display available test result suites. #}
{% set summary = request.get_db_summary() %}
-<h3>Test Results</h3>
+<h3>Test Suites</h3>
{% for suite in summary.suites %}
<a href="{{ '/'.join(suite.path) }}">{{suite.name}}</a><br>
{% endfor %}
-{% if g.db_info.showGeneral %}
+{% if g.db_info.db_version == '0.3' and g.db_info.showGeneral %}
<hr>
<h3>General Database Access</h3>
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=147040&r1=147039&r2=147040&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/ui/views.py (original)
+++ zorg/trunk/lnt/lnt/server/ui/views.py Wed Dec 21 00:22:04 2011
@@ -46,7 +46,7 @@
# Per-Database Routes
# Decorator for implementing per-database routes.
-def db_route(rule, **options):
+def db_route(rule, only_v3 = True, **options):
"""
LNT specific route for endpoints which always refer to some database
object.
@@ -62,12 +62,13 @@
if g.db_info is None:
abort(404)
- # Currently the UI has absolutely no support for non-v0.3 databases.
- if g.db_info.db_version != '0.3':
+ # Disable non-v0.3 database support, if requested.
+ if only_v3 and g.db_info.db_version != '0.3':
return render_template("error.html", message="""\
UI support for database with version %r is not yet implemented.""" % (
g.db_info.db_version))
+
return f(**args)
frontend.add_url_rule(rule, f.__name__, wrap, **options)
@@ -77,7 +78,7 @@
return wrap
return decorator
- at db_route('/')
+ at db_route('/', only_v3 = False)
def index():
return render_template("index.html")
More information about the llvm-commits
mailing list