[llvm-commits] [zorg] r99272 - in /zorg/trunk/lnt/lnt/viewer: NTStyleBrowser.ptl nightlytest.ptl

Daniel Dunbar daniel at zuster.org
Tue Mar 23 02:59:23 PDT 2010


Author: ddunbar
Date: Tue Mar 23 04:59:22 2010
New Revision: 99272

URL: http://llvm.org/viewvc/llvm-project?rev=99272&view=rev
Log:
LNT: Move the machine view to common code.

Modified:
    zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl
    zorg/trunk/lnt/lnt/viewer/nightlytest.ptl

Modified: zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl?rev=99272&r1=99271&r2=99272&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl (original)
+++ zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl Tue Mar 23 04:59:22 2010
@@ -227,7 +227,14 @@
                 <td> <b>Nickname</b> </td>
                 <td> %s </td>
               </tr>
-        """ %  (machine.name,)
+              <tr>
+                <td> <b>Machine ID</b> </td>
+                <td> %d </td>
+              </tr>
+              </table>
+              <p>
+              <table border=1>
+        """ %  (machine.name, machine.id)
         for mi in machine.info.values():
             """
               <tr>
@@ -236,12 +243,20 @@
               </tr>
             """ % (mi.key, mi.value)
         """
+              </table>
+              <p>
+              <table border=1>
+        """
+        for ri in run.info.values():
+            """
               <tr>
-                <td> <b>Machine ID</b> </td>
-                <td> %d </td>
+                <td> <b>%s</b> </td>
+                <td>%s</td>
               </tr>
+            """ % (ri.key, ri.value)
+        """
               </table>
-        """ % (machine.id,)
+        """
 
         if allResults:
             """<h4><a href="?full=">See Brief Test Results</a></h4>"""
@@ -280,6 +295,127 @@
     def renderCommonContents(self, db, run, compareTo, summary):
         abstract
 
+class MachineUI(Directory):
+    _q_exports = [""]
+
+    def __init__(self, root, idstr):
+        self.root = root
+        try:
+            self.id = int(idstr)
+        except ValueError, exc:
+            raise TraversalError(str(exc))
+
+    def _q_index [html] (self):
+        # Get a DB connection.
+        db = self.root.getDB()
+
+        machine = db.getMachine(self.id)
+
+        self.root.getHeader("Machine: %s:%d" % (machine.name,machine.number),
+                            "../../..",
+                            components=(('nightlytest','nightlytest'),),
+                            addPopupJS=True)
+
+        # Find all runs on this machine.
+        runs = db.runs(machine).order_by(Run.start_time.desc()).all()
+
+        # FIXME: List previous machines with the same nickname?
+        """
+        <table width="100%%" border=1>
+          <tr>
+            <td valign="top" width="200">
+              <a href="../..">Homepage</a>
+              <h4>Relatives:</h4>
+              <ul>
+        """
+        # List all machines with this name.
+        for m in db.machines(name=machine.name):
+            """<li><a href="../%d">%s:%d</a></li>""" % (m.id, m.name, m.number)
+        """
+              </ul>
+              <h4>Runs:</h4>
+              <ul>
+        """
+
+        # Show the most recent 10 runs.
+        for r in runs[:10]:
+            """ <li> <a href="../../%d/">%s</a> """ % (r.id, r.start_time)
+
+        # Full list of runs in a drop down.
+        #
+        # FIXME: Link to run correctly.
+        """
+        <p>
+        <form method="GET" action="../../1/">
+        <select name="run">
+        """
+        for r in runs:
+            """\
+        <option value="%d">%s""" % (r.id, r.start_time)
+
+        """
+        </select>
+        <input type="submit" value="Go to Run">
+        </form>
+        """
+
+        """
+              </ul>
+            </td>
+            <td valign="top">
+              <table border=1>
+              <tr>
+                <td> <b>Nickname</b> </td>
+                <td> %s </td>
+              </tr>
+              <tr>
+                <td> <b>Machine ID</b> </td>
+                <td> %d </td>
+              </tr>
+              </table>
+              <p>
+              <table border=1>
+              <tr>
+        """ % (machine.name, machine.id)
+        for mi in machine.info.values():
+            """
+              <tr>
+                <td> <b>%s</b> </td>
+                <td>%s</td>
+              </tr>
+            """ % (mi.key, mi.value)
+
+        # List associated runs.
+        """
+        </table>
+        <p>
+        <table class="sortable" border=1>
+        <thead>
+          <tr>
+            <th>Start Time</th>
+            <th>End Time</th>
+            <th> </th>
+        </thead>
+        """
+        for r in runs:
+            """
+          <tr>
+            <td>%s</td>
+            <td>%s</td>
+            <td><a href="../../%d">View Results</a></td>
+          </tr>""" % (r.start_time, r.end_time, r.id)
+        """
+        </table>
+        """
+
+        """
+            </td>
+          </tr>
+        </table>
+        """
+
+        self.root.getFooter()
+
 class MachinesDirectory(Directory):
     _q_exports = [""]
 
@@ -293,7 +429,7 @@
         """
 
     def _q_lookup(self, component):
-        return self.parent.getTestMachineUI(component)
+        return MachineUI(self.parent.root, component)
 
 class ProgramsDirectory(Directory):
     _q_exports = [""]
@@ -349,6 +485,15 @@
             # Get the most recent run for this machine name.
             q = db.session.query(Run).join(Machine).filter(Machine.name == name)
             r = q.order_by(Run.start_time.desc()).first()
+
+            # Limit by matching tags.
+            if 'tag' in r.info:
+                tag = r.info['tag'].value
+            else:
+                tag = None
+            if tag not in self.getTags():
+                continue
+
             """
               <tr>
                 <td>%s</td>
@@ -378,6 +523,14 @@
 
         # Show the 20 most recent submissions, ordered by time.
         for r in db.session.query(Run).order_by(Run.start_time.desc())[:20]:
+            # Limit by matching tags.
+            if 'tag' in r.info:
+                tag = r.info['tag'].value
+            else:
+                tag = None
+            if tag not in self.getTags():
+                continue
+
             m = r.machine
             """
               <tr>

Modified: zorg/trunk/lnt/lnt/viewer/nightlytest.ptl
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/nightlytest.ptl?rev=99272&r1=99271&r2=99272&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/nightlytest.ptl (original)
+++ zorg/trunk/lnt/lnt/viewer/nightlytest.ptl Tue Mar 23 04:59:22 2010
@@ -26,9 +26,6 @@
         NTStyleBrowser.TestRunUI.__init__(self, *args, **kwargs)
         self.popupDepth = 0
 
-    def getTags(self):
-        return (None, 'nightlytest')
-
     def getParameters(self):
         return ()
 
@@ -503,125 +500,6 @@
 
         self.root.getFooter()
 
-class NightlyTestMachineUI(Directory):
-    _q_exports = [""]
-
-    def __init__(self, root, idstr):
-        self.root = root
-        try:
-            self.id = int(idstr)
-        except ValueError, exc:
-            raise TraversalError(str(exc))
-
-    def _q_index [html] (self):
-        # Get a DB connection.
-        db = self.root.getDB()
-
-        machine = db.getMachine(self.id)
-
-        self.root.getHeader("Machine: %s:%d" % (machine.name,machine.number),
-                            "../../..",
-                            components=(('nightlytest','nightlytest'),),
-                            addPopupJS=True)
-
-        # Find all runs on this machine.
-        runs = db.runs(machine).order_by(Run.start_time.desc()).all()
-
-        # FIXME: List previous machines with the same nickname?
-        """
-        <table width="100%%" border=1>
-          <tr>
-            <td valign="top" width="200">
-              <a href="../..">Homepage</a>
-              <h4>Relatives:</h4>
-              <ul>
-        """
-        # List all machines with this name.
-        for m in db.machines(name=machine.name):
-            """<li><a href="../%d">%s:%d</a></li>""" % (m.id, m.name, m.number)
-        """
-              </ul>
-              <h4>Runs:</h4>
-              <ul>
-        """
-
-        # Show the most recent 10 runs.
-        for r in runs[:10]:
-            """ <li> <a href="../../%d/">%s</a> """ % (r.id, r.start_time)
-
-        # Full list of runs in a drop down.
-        #
-        # FIXME: Link to run correctly.
-        """
-        <p>
-        <form method="GET" action="../../1/">
-        <select name="run">
-        """
-        for r in runs:
-            """\
-        <option value="%d">%s""" % (r.id, r.start_time)
-
-        """
-        </select>
-        <input type="submit" value="Go to Run">
-        </form>
-        """
-
-        """
-              </ul>
-            </td>
-            <td valign="top">
-              <table border=1>
-              <tr>
-                <td> <b>Nickname</b> </td>
-                <td> %s </td>
-              </tr>
-        """ %  (machine.name,)
-        for mi in machine.info.values():
-            """
-              <tr>
-                <td> <b>%s</b> </td>
-                <td>%s</td>
-              </tr>
-            """ % (mi.key, mi.value)
-        """
-              <tr>
-                <td> <b>Machine ID</b> </td>
-                <td> %d </td>
-              </tr>
-              </table>
-              <p>
-        """ % (machine.id,)
-
-        # List associated runs.
-        """
-        <table class="sortable" border=1>
-        <thead>
-          <tr>
-            <th>Start Time</th>
-            <th>End Time</th>
-            <th> </th>
-        </thead>
-        """
-        for r in runs:
-            """
-          <tr>
-            <td>%s</td>
-            <td>%s</td>
-            <td><a href="../../%d">View Results</a></td>
-          </tr>""" % (r.start_time, r.end_time, r.id)
-        """
-        </table>
-        """
-
-        """
-            </td>
-          </tr>
-        </table>
-        """
-
-        self.root.getFooter()
-
 class NightlyTestProgramUI(Directory):
     _q_exports = [""]
 
@@ -768,8 +646,5 @@
     def getTestRunUI(self, component):
         return NightlyTestRunUI(self.root, component)
 
-    def getTestMachineUI(self, component):
-        return NightlyTestMachineUI(self.root, component)
-
     def getProgramUI(self, component):
         return NightlyTestProgramUI(self.root, component)





More information about the llvm-commits mailing list