Skip to content

Commit

Permalink
specify a default num_events value for the waterfall in the master
Browse files Browse the repository at this point in the history
config file instead of changing a hard coded value, and add a
configurable limit, too
  • Loading branch information
jhford authored and Dustin J. Mitchell committed Nov 23, 2009
1 parent f77caa6 commit cadbb9d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
23 changes: 19 additions & 4 deletions buildbot/status/web/baseweb.py
Expand Up @@ -398,7 +398,8 @@ class WebStatus(service.MultiService):
# all the changes).

def __init__(self, http_port=None, distrib_port=None, allowForce=False,
public_html="public_html", site=None, numbuilds=20, auth=None):
public_html="public_html", site=None, numbuilds=20,
num_events=200, num_event_max=None, auth=None):
"""Run a web server that provides Buildbot status.
@type http_port: int or L{twisted.application.strports} string
Expand Down Expand Up @@ -449,6 +450,14 @@ def __init__(self, http_port=None, distrib_port=None, allowForce=False,
by passing the equally named argument to constructors of OneLinePerBuildOneBuilder
and OneLinePerBuild --- and via the UI, by tacking ?numbuilds=xy onto the URL.
@type num_events: int
@param num_events: Defaualt number of events to show in the waterfall.
@type num_events_max: int
@param num_events_max: The maximum number of events that are allowed to be
shown in the waterfall. The default value of C{None} will disable this
check
@type auth: a L{status.web.auth.IAuth} or C{None}
@param auth: an object that performs authentication to restrict access
to the C{allowForce} features. Ignored if C{allowForce}
Expand All @@ -467,6 +476,10 @@ def __init__(self, http_port=None, distrib_port=None, allowForce=False,
distrib_port = "unix:%s" % distrib_port
self.distrib_port = distrib_port
self.allowForce = allowForce
self.num_events = num_events
if num_events_max:
assert num_events_max >= num_events
self.num_events_max = num_events_max
self.public_html = public_html

if self.allowForce and auth:
Expand All @@ -488,7 +501,8 @@ def __init__(self, http_port=None, distrib_port=None, allowForce=False,
self.site = server.Site(root)
self.childrenToBeAdded = {}

self.setupUsualPages(numbuilds=numbuilds)
self.setupUsualPages(numbuilds=numbuilds, num_events=num_events,
num_events_max=num_events_max)

# the following items are accessed by HtmlResource when it renders
# each page.
Expand All @@ -511,9 +525,10 @@ def __init__(self, http_port=None, distrib_port=None, allowForce=False,
s = strports.service(self.distrib_port, f)
s.setServiceParent(self)

def setupUsualPages(self, numbuilds):
def setupUsualPages(self, numbuilds, num_events, num_events_max):
#self.putChild("", IndexOrWaterfallRedirection())
self.putChild("waterfall", WaterfallStatusResource())
self.putChild("waterfall", WaterfallStatusResource(num_events=num_events,
num_events_max=num_events_max))
self.putChild("grid", GridStatusResource())
self.putChild("console", ConsoleStatusResource())
self.putChild("tgrid", TransposedGridStatusResource())
Expand Down
10 changes: 8 additions & 2 deletions buildbot/status/web/waterfall.py
Expand Up @@ -417,9 +417,11 @@ class WaterfallStatusResource(HtmlResource):
"""This builds the main status page, with the waterfall display, and
all child pages."""

def __init__(self, categories=None):
def __init__(self, categories=None, num_events=200, num_events_max=None):
HtmlResource.__init__(self)
self.categories = categories
self.num_events=num_events
self.num_events_max=num_events_max
self.putChild("help", WaterfallHelp(categories))

def getTitle(self, request):
Expand Down Expand Up @@ -699,7 +701,11 @@ def buildGrid(self, request, builders):
else:
minTime = None
spanLength = 10 # ten-second chunks
maxPageLen = int(request.args.get("num_events", [200])[0])
req_events=int(request.args.get("num_events", [self.num_events])[0])
if self.num_events_max and req_events > self.num_events_max:
maxPageLen = self.num_events_max
else:
maxPageLen = req_events

# first step is to walk backwards in time, asking each column
# (commit, all builders) if they have any events there. Build up the
Expand Down

0 comments on commit cadbb9d

Please sign in to comment.