[Buildbot-commits] buildbot/buildbot/status/web waterfall.py, 1.11, 1.12

Brian Warner warner at users.sourceforge.net
Mon Aug 13 06:33:49 UTC 2007


Update of /cvsroot/buildbot/buildbot/buildbot/status/web
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4648/buildbot/status/web

Modified Files:
	waterfall.py 
Log Message:
[project @ waterfall: add queryargs to control what timespan of events are shown. Helps with #67.]

Original author: warner at lothar.com
Date: 2007-08-13 06:33:21+00:00

Index: waterfall.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/status/web/waterfall.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- waterfall.py	2 Aug 2007 00:26:59 -0000	1.11
+++ waterfall.py	13 Aug 2007 06:33:47 -0000	1.12
@@ -335,6 +335,22 @@
 
         data += "<hr />\n"
 
+        if timestamps:
+            # sigh, nevow makes this sort of manipulation easier
+            bottom = timestamps[-1]
+            newargs = request.args.copy()
+            newargs["last_time"] = [str(int(bottom))]
+            newquery = "&".join(["%s=%s" % (k, v)
+                                 for k in newargs
+                                 for v in newargs[k]
+                                 ])
+            nextpage = str(request.URLPath())
+            if newquery:
+                nextpage += "?" + newquery
+            data += '<a href="%s">next page</a>\n' % nextpage
+        data += "<br />\n"
+
+
         bburl = "http://buildbot.net/?bb-ver=%s" % urllib.quote(version)
         data += "<a href=\"%s\">Buildbot-%s</a> " % (bburl, version)
         if projectName:
@@ -406,6 +422,15 @@
         if request.args.get("show_events", ["true"])[0].lower() == "true":
             showEvents = True
         filterBranches = request.args.get("branch", [])
+        maxTime = int(request.args.get("last_time", [util.now()])[0])
+        if "show_time" in request.args:
+            minTime = maxTime - int(request.args["show_time"][0])
+        elif "first_time" in request.args:
+            minTime = int(request.args["first_time"][0])
+        else:
+            minTime = None
+        spanLength = 10  # ten-second chunks
+        maxPageLen = int(request.args.get("num_events", [200])[0])
 
         # first step is to walk backwards in time, asking each column
         # (commit, all builders) if they have any events there. Build up the
@@ -442,9 +467,6 @@
             sourceEvents.append(get_event_from(gen))
         eventGrid = []
         timestamps = []
-        spanLength = 10  # ten-second chunks
-        tooOld = util.now() - 12*60*60 # never show more than 12 hours
-        maxPageLen = 200
 
         lastEventTime = 0
         for e in sourceEvents:
@@ -496,19 +518,21 @@
                 sourceEvents[c] = event # refill the tableau
                 spanEvents.append(events)
 
-            if firstTimestamp is not None:
+            # only show events older than maxTime. This makes it possible to
+            # visit a page that shows what it would be like to scroll off the
+            # bottom of this one.
+            if firstTimestamp is not None and firstTimestamp <= maxTime:
                 eventGrid.append(spanEvents)
                 timestamps.append(firstTimestamp)
-            
 
             if lastTimestamp:
                 spanStart = lastTimestamp - spanLength
             else:
                 # no more events
                 break
-            if lastTimestamp < tooOld:
-                pass
-                #break
+            if minTime is not None and lastTimestamp < minTime:
+                break
+
             if len(timestamps) > maxPageLen:
                 break
             





More information about the Commits mailing list