Title: [94228] trunk/Tools
Revision
94228
Author
e...@webkit.org
Date
2011-08-31 13:58:17 -0700 (Wed, 31 Aug 2011)

Log Message

Add queues.webkit.org/active-bots page to make it easy to see which bots are down
https://bugs.webkit.org/show_bug.cgi?id=67314

Reviewed by Adam Barth.

Very simple page.  Just lists all the bots, what queue they belong to and what we last heard from them.
If we haven't heard from a bot in the last 500 messages (last day or so), then it won't show up here.
This makes it very easy for me to see which of my cr-jail bots might be down at any one time.

I also moved a bunch of code into dashboard.css which belonged there.

* QueueStatusServer/handlers/activebots.py: Added.
* QueueStatusServer/main.py:
* QueueStatusServer/stylesheets/dashboard.css:
(.queue_bubble):
(.queue_name):
(.last_heard_from):
(.status_text):
(.alive):
(.behind):
(.dead):
* QueueStatusServer/templates/activebots.html: Added.
* QueueStatusServer/templates/dashboard.html:
* QueueStatusServer/templates/recentstatus.html:

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (94227 => 94228)


--- trunk/Tools/ChangeLog	2011-08-31 20:56:10 UTC (rev 94227)
+++ trunk/Tools/ChangeLog	2011-08-31 20:58:17 UTC (rev 94228)
@@ -1,3 +1,30 @@
+2011-08-31  Eric Seidel  <e...@webkit.org>
+
+        Add queues.webkit.org/active-bots page to make it easy to see which bots are down
+        https://bugs.webkit.org/show_bug.cgi?id=67314
+
+        Reviewed by Adam Barth.
+
+        Very simple page.  Just lists all the bots, what queue they belong to and what we last heard from them.
+        If we haven't heard from a bot in the last 500 messages (last day or so), then it won't show up here.
+        This makes it very easy for me to see which of my cr-jail bots might be down at any one time.
+
+        I also moved a bunch of code into dashboard.css which belonged there.
+
+        * QueueStatusServer/handlers/activebots.py: Added.
+        * QueueStatusServer/main.py:
+        * QueueStatusServer/stylesheets/dashboard.css:
+        (.queue_bubble):
+        (.queue_name):
+        (.last_heard_from):
+        (.status_text):
+        (.alive):
+        (.behind):
+        (.dead):
+        * QueueStatusServer/templates/activebots.html: Added.
+        * QueueStatusServer/templates/dashboard.html:
+        * QueueStatusServer/templates/recentstatus.html:
+
 2011-08-31  Oliver Hunt  <oli...@apple.com>
 
         Move CheckedArithmeticOperations.cpp to the intended location

Added: trunk/Tools/QueueStatusServer/handlers/activebots.py (0 => 94228)


--- trunk/Tools/QueueStatusServer/handlers/activebots.py	                        (rev 0)
+++ trunk/Tools/QueueStatusServer/handlers/activebots.py	2011-08-31 20:58:17 UTC (rev 94228)
@@ -0,0 +1,56 @@
+# Copyright (C) 2010 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import datetime
+import itertools
+import operator
+
+from google.appengine.ext import webapp
+from google.appengine.ext.webapp import template
+
+from model.queues import Queue
+from model import queuestatus
+
+
+class ActiveBots(webapp.RequestHandler):
+    def get(self):
+        # 2000 is the GAE record fetch limit.
+        recent_statuses = queuestatus.QueueStatus.all().order("-date").fetch(500)
+        queue_name_to_last_status = {}
+        for status in recent_statuses:
+            last_status = queue_name_to_last_status.get(status.bot_id)
+            if not last_status or status.date > last_status.date:
+                queue_name_to_last_status[status.bot_id] = status
+
+        sorted_by_bot_id = sorted(queue_name_to_last_status.values(), key=operator.attrgetter('bot_id'))
+        # Sorted is stable, so this will be sorted by bot_id, groupped by sorted queue_name.
+        sorted_by_queue_name = sorted(sorted_by_bot_id, key=operator.attrgetter('queue_name'))
+        template_values = {
+            "last_statuses": sorted_by_queue_name,
+        }
+        self.response.out.write(template.render("templates/activebots.html", template_values))

Modified: trunk/Tools/QueueStatusServer/main.py (94227 => 94228)


--- trunk/Tools/QueueStatusServer/main.py	2011-08-31 20:56:10 UTC (rev 94227)
+++ trunk/Tools/QueueStatusServer/main.py	2011-08-31 20:58:17 UTC (rev 94228)
@@ -33,6 +33,7 @@
 from google.appengine.ext import webapp
 from google.appengine.ext.webapp.util import run_wsgi_app
 
+from handlers.activebots import ActiveBots
 from handlers.dashboard import Dashboard
 from handlers.gc import GC
 from handlers.nextpatch import NextPatch
@@ -69,6 +70,7 @@
     ('/update-status', UpdateStatus),
     ('/update-work-items', UpdateWorkItems),
     ('/update-svn-revision', UpdateSVNRevision),
+    ('/active-bots', ActiveBots),
 ]
 
 application = webapp.WSGIApplication(routes, debug=True)

Modified: trunk/Tools/QueueStatusServer/stylesheets/dashboard.css (94227 => 94228)


--- trunk/Tools/QueueStatusServer/stylesheets/dashboard.css	2011-08-31 20:56:10 UTC (rev 94227)
+++ trunk/Tools/QueueStatusServer/stylesheets/dashboard.css	2011-08-31 20:58:17 UTC (rev 94228)
@@ -101,3 +101,27 @@
   cursor: pointer;
   /* border: 1px solid #ACA0B3; */
 }
+.queue_bubble {
+    border: 1px solid black;
+    margin-bottom: 10px;
+    border-radius: 10px;
+    padding: 5px;
+}
+.queue_name {
+    float:left;
+}
+.last_heard_from {
+    float: right;
+}
+.status_text {
+    clear: both;
+}
+.alive {
+    background-color: #8FDF5F;
+}
+.behind {
+    background-color: #FFFC6C;
+}
+.dead {
+    background-color: #E98080;
+}
\ No newline at end of file

Added: trunk/Tools/QueueStatusServer/templates/activebots.html (0 => 94228)


--- trunk/Tools/QueueStatusServer/templates/activebots.html	                        (rev 0)
+++ trunk/Tools/QueueStatusServer/templates/activebots.html	2011-08-31 20:58:17 UTC (rev 94228)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>WebKit Queue Status</title>
+<link type="text/css" rel="stylesheet" href="" />
+<style>
+/* Override the generic table styles from dashboard.css */
+td {
+  text-align: left;
+}
+</style>
+</head>
+<body>
+<h1>WebKit Queue Status</h1>
+<table>
+    <thead>
+        <tr>
+            <th>Bot</th><th>Queue</th><th>Last Message</th><th>Time</th>
+        </tr>
+    </thead>
+    <tbody>
+        {% for status in last_statuses %}
+        <tr>
+            <td><a href="" status.bot_id }}</a></td>
+            <td><a href="" status.queue_name }}</a></td>
+            <td>{{ status.message|force_escape|urlize|webkit_linkify|safe }}</td>
+            <td>{{ status.date|timesince }} ago</td>
+        </tr>
+        {% endfor %}
+    </tbody>
+</table>
+</body>
+</html>

Modified: trunk/Tools/QueueStatusServer/templates/dashboard.html (94227 => 94228)


--- trunk/Tools/QueueStatusServer/templates/dashboard.html	2011-08-31 20:56:10 UTC (rev 94227)
+++ trunk/Tools/QueueStatusServer/templates/dashboard.html	2011-08-31 20:58:17 UTC (rev 94228)
@@ -13,7 +13,7 @@
 <body>
 <h1>WebKit Bot Status</h1>
 <table>
-  <theader>
+  <thead>
     <tr>
       <th>Bug</th>
       <th>Attachment</th>

Modified: trunk/Tools/QueueStatusServer/templates/recentstatus.html (94227 => 94228)


--- trunk/Tools/QueueStatusServer/templates/recentstatus.html	2011-08-31 20:56:10 UTC (rev 94227)
+++ trunk/Tools/QueueStatusServer/templates/recentstatus.html	2011-08-31 20:58:17 UTC (rev 94228)
@@ -3,32 +3,6 @@
 <head>
 <title>WebKit Queue Status</title>
 <link type="text/css" rel="stylesheet" href="" />
-<style>
-.queue_bubble {
-    border: 1px solid black;
-    margin-bottom: 10px;
-    border-radius: 10px;
-    padding: 5px;
-}
-.queue_name {
-    float:left;
-}
-.last_heard_from {
-    float: right;
-}
-.status_text {
-    clear: both;
-}
-.alive {
-    background-color: #8FDF5F;
-}
-.behind {
-    background-color: #FFFC6C;
-}
-.dead {
-    background-color: #E98080;
-}
-</style>
 </head>
 <body>
 <h1>WebKit Queue Status</h1>
@@ -50,5 +24,6 @@
     </div>
 </div>
 {% endfor %}
+<a href=''>List of all active bots</a>
 </body>
 </html>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to