[llvm-commits] [zorg] r105564 - in /zorg/trunk/lnt/lnt: db/ db/__init__.py db/perfdbsummary.py viewer/NTStyleBrowser.ptl viewer/root.ptl viewer/simple.ptl
Daniel Dunbar
daniel at zuster.org
Mon Jun 7 16:00:19 PDT 2010
Author: ddunbar
Date: Mon Jun 7 18:00:19 2010
New Revision: 105564
URL: http://llvm.org/viewvc/llvm-project?rev=105564&view=rev
Log:
LNT/viewer: Add support for multiple 'simple' style test suites within the same
database.
Added:
zorg/trunk/lnt/lnt/db/
zorg/trunk/lnt/lnt/db/__init__.py
zorg/trunk/lnt/lnt/db/perfdbsummary.py
Modified:
zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl
zorg/trunk/lnt/lnt/viewer/root.ptl
zorg/trunk/lnt/lnt/viewer/simple.ptl
Added: zorg/trunk/lnt/lnt/db/__init__.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/db/__init__.py?rev=105564&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/db/__init__.py (added)
+++ zorg/trunk/lnt/lnt/db/__init__.py Mon Jun 7 18:00:19 2010
@@ -0,0 +1 @@
+__all__ = []
Added: zorg/trunk/lnt/lnt/db/perfdbsummary.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/db/perfdbsummary.py?rev=105564&view=auto
==============================================================================
--- zorg/trunk/lnt/lnt/db/perfdbsummary.py (added)
+++ zorg/trunk/lnt/lnt/db/perfdbsummary.py Mon Jun 7 18:00:19 2010
@@ -0,0 +1,36 @@
+"""
+Classes for caching metadata about a PerfDB instance.
+"""
+
+from lnt.viewer.PerfDB import RunInfo
+
+class SuiteSummary:
+ def __init__(self, name, path):
+ self.name = name
+ self.path = path
+
+class PerfDBSummary:
+ @staticmethod
+ def fromdb(db):
+ revision = db.get_revision_number("Run")
+
+ # Look for all the run tags and use them to identify the available
+ # suites.
+ q = db.session.query(RunInfo.value.distinct())
+ q = q.filter(RunInfo.key == "tag")
+
+ suites = [SuiteSummary("Nightlytest", ("nightlytest",))]
+ for tag, in q:
+ if tag == 'nightlytest':
+ continue
+ suites.append(SuiteSummary(tag, ("simple",tag)))
+
+ suites.sort(key=lambda s: s.name)
+ return PerfDBSummary(revision, suites)
+
+ def __init__(self, revision, suites):
+ self.revision = revision
+ self.suites = suites
+
+ def is_up_to_date(self, db):
+ return self.revision == db.get_revision("Run")
Modified: zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl?rev=105564&r1=105563&r2=105564&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl (original)
+++ zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl Mon Jun 7 18:00:19 2010
@@ -17,7 +17,7 @@
import Util
from NTUtil import *
-from PerfDB import Machine, Run
+from PerfDB import Machine, Run, RunInfo
class TestRunUI(Directory):
def __init__(self, root, idstr):
@@ -316,8 +316,9 @@
class MachineUI(Directory):
_q_exports = [""]
- def __init__(self, root, idstr):
+ def __init__(self, root, parent, idstr):
self.root = root
+ self.parent = parent
try:
self.id = int(idstr)
except ValueError, exc:
@@ -345,8 +346,8 @@
machine = db.getMachine(self.id)
self.root.getHeader("Machine: %s:%d" % (machine.name,machine.number),
- "../../..",
- components=(('nightlytest','nightlytest'),),
+ "%s/../.." % self.parent.root_path,
+ components=self.parent.components,
addPopupJS=True)
# Find all runs on this machine.
@@ -489,7 +490,7 @@
"""
def _q_lookup(self, component):
- return MachineUI(self.parent.root, component)
+ return MachineUI(self.parent.root, self.parent, component)
class ProgramsDirectory(Directory):
_q_exports = [""]
@@ -510,6 +511,8 @@
def __init__(self, root):
Directory.__init__(self)
self.root = root
+ self.root_path = '..'
+ self.components = (('nightlytest','nightlytest'),)
def getTags(self):
abstract
@@ -518,8 +521,7 @@
# Get a DB connection
db = self.root.getDB()
- self.root.getHeader('Overview', "..",
- components=(('nightlytest','nightlytest'),))
+ self.root.getHeader('Overview', self.root_path, self.components)
# Find recent runs.
"""
Modified: zorg/trunk/lnt/lnt/viewer/root.ptl
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/root.ptl?rev=105564&r1=105563&r2=105564&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/root.ptl (original)
+++ zorg/trunk/lnt/lnt/viewer/root.ptl Mon Jun 7 18:00:19 2010
@@ -17,8 +17,9 @@
from quixote.util import StaticDirectory
import lnt
-import PerfDB, Util
-from PerfDB import Machine, Run
+from lnt.db import perfdbsummary
+from lnt.viewer import PerfDB, Util
+from lnt.viewer.PerfDB import Machine, Run
class RootDirectory(Resolving, Directory):
_q_exports = ["", "resources", "js", "machines", "runs", "tests",
@@ -36,6 +37,7 @@
if self.dbInfo is None:
self.dbInfo = config.databases[dbName]
self.pathToRoot = pathToRoot
+ self.db_summary = None
def getDB(self):
db = PerfDB.PerfDB(self.dbInfo.path)
@@ -170,22 +172,25 @@
time.localtime(current)),
current - quixote.get_request().start_time)
+ def get_db_summary(self, db):
+ if not self.db_summary or not self.db_summary.is_up_to_date(db):
+ self.db_summary = perfdbsummary.PerfDBSummary.fromdb(db)
+ return self.db_summary
+
def _q_index [html] (self):
+ # Get a DB connection.
+ db = self.getDB()
+
self.getHeader("Overview", ".",
components=(),)
- # Available UIs.
-
- if self.dbInfo.showSimple:
- """
- <a href="simple/">Simple Test Viewer</a>
- """
-
- if self.dbInfo.showNightlytest:
- """
- <h3>Nightly Test Results</h3>
- <a href="nightlytest/">Nightly Test</a>
+ # Display available test result suites.
+ summary = self.get_db_summary(db)
+ """
+ <h3>Test Results</h3>"""
+ for suite in summary.suites:
"""
+ <a href="%s">%s</a><br>""" % (os.path.join(*suite.path), suite.name)
if self.dbInfo.showGeneral:
"""
Modified: zorg/trunk/lnt/lnt/viewer/simple.ptl
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/simple.ptl?rev=105564&r1=105563&r2=105564&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/simple.ptl (original)
+++ zorg/trunk/lnt/lnt/viewer/simple.ptl Mon Jun 7 18:00:19 2010
@@ -33,8 +33,9 @@
class SimpleRunUI(Directory):
_q_exports = ["", "graph"]
- def __init__(self, root, idstr):
+ def __init__(self, root, tag, idstr):
self.root = root
+ self.tag = tag
try:
self.id = int(idstr)
except ValueError, exc:
@@ -70,8 +71,9 @@
# Find previous runs, ordered by time.
runs = db.runs(run.machine).order_by(Run.start_time.desc()).all()
+ # FIXME: Fold this into query.
runs = [r for r in runs
- if 'tag' in r.info and r.info['tag'].value == 'simple']
+ if 'tag' in r.info and r.info['tag'].value == self.tag]
# Order by run_order info key, if given.
for r in runs:
@@ -204,10 +206,12 @@
run,runs,has_order,compareTo = self.getInfo(db)
machine = run.machine
- self.root.getHeader('Run Results', "../..",
- components=(('simple','simple'),
+ self.root.getHeader('Run Results', "../../..",
+ components=((self.tag,
+ '%s/%s' % ('simple',self.tag)),
('machine',
- 'simple/machines/%d' % machine.id)),
+ 'simple/%s/machines/%d'%(self.tag,
+ machine.id))),
addPopupJS=True, addFormCSS=True)
self.show_run_page(db, run, runs, compareTo, self._q_index_body)
@@ -458,7 +462,7 @@
graph.draw();
}
""" % (plots,xAxis_format)
- self.root.getHeader('Run Results', "..",
+ self.root.getHeader('Run Results', "../..",
components=(('simple','simple'),
('machine',
'simple/machines/%d' % machine.id),
@@ -476,7 +480,7 @@
# Find all test names.
q = db.session.query(Test)
- q = q.filter(Test.name.startswith(str('simple.')))
+ q = q.filter(Test.name.startswith(self.tag))
tests = list(q)
# Collect all the test data.
@@ -631,11 +635,25 @@
<input type="submit" value="Graph">
</form>"""
-class RootDirectory(NTStyleBrowser.RecentMachineDirectory):
+class TagRootDirectory(NTStyleBrowser.RecentMachineDirectory):
_q_exports = [""]
+ def __init__(self, root, tag):
+ NTStyleBrowser.RecentMachineDirectory.__init__(self, root)
+ self.tag = tag
+ self.root_path = '../..'
+ self.components = ((self.tag, '%s/%s' % ('simple',self.tag)),)
+
def getTags(self):
- return ('simple',)
+ return (self.tag,)
def getTestRunUI(self, component):
- return SimpleRunUI(self.root, component)
+ return SimpleRunUI(self.root, self.tag, component)
+
+class RootDirectory(Directory):
+ def __init__(self, root):
+ Directory.__init__(self)
+ self.root = root
+
+ def _q_lookup(self, component):
+ return TagRootDirectory(self.root, component)
More information about the llvm-commits
mailing list