Skip to content

Commit

Permalink
dismabiguate getPendingBuilds methods
Browse files Browse the repository at this point in the history
ayust can thank me later!
  • Loading branch information
djmitche committed Apr 19, 2011
1 parent 3a43dc3 commit 74032be
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 14 deletions.
3 changes: 3 additions & 0 deletions master/NEWS
Expand Up @@ -32,6 +32,9 @@ invocations.

*** The `Status.getBuildSets` method now returns its result via Deferred.

*** The `BuilderControl.getPendingBuilds` method has been renamed to
`getPendingBuildRequestControls`

** Scheduler Improvements

*** Nightly scheduler now accepts a change_filter argument
Expand Down
4 changes: 2 additions & 2 deletions master/buildbot/interfaces.py
Expand Up @@ -333,7 +333,7 @@ def getSlaves():
"""Return a list of ISlaveStatus objects for the buildslaves that are
used by this builder."""

def getPendingBuilds():
def getPendingBuildRequestStatuses():
"""Return an IBuildRequestStatus object for all upcoming builds
(those which are ready to go but which are waiting for a buildslave
to be available."""
Expand Down Expand Up @@ -1016,7 +1016,7 @@ def rebuildBuild(buildStatus, reason="<rebuild, no reason given>"):
build. This has no effect (but may eventually raise an exception) if
this Build has not yet finished."""

def getPendingBuilds():
def getPendingBuildRequestControls():
"""Return a list of L{IBuildRequestControl} objects for this Builder.
Each one corresponds to a pending build that has not yet started (due
to a scarcity of build slaves). These upcoming builds can be canceled
Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/process/builder.py
Expand Up @@ -841,7 +841,7 @@ def add_buildset(ssid):
d.addCallback(add_buildset)
return d

def getPendingBuilds(self):
def getPendingBuildRequestControls(self):
# return IBuildRequestControl objects
retval = []
for r in self.original.getBuildable():
Expand Down
4 changes: 2 additions & 2 deletions master/buildbot/status/builder.py
Expand Up @@ -302,7 +302,7 @@ def getState(self):
def getSlaves(self):
return [self.status.getSlave(name) for name in self.slavenames]

def getPendingBuilds(self):
def getPendingBuildRequestStatuses(self):
db = self.status.db
return [BuildRequestStatus(brid, self.status, db)
for brid in db.get_pending_brids_for_builder(self.name)]
Expand Down Expand Up @@ -616,6 +616,6 @@ def asDict(self):
result['cachedBuilds'] = cached_builds
result['currentBuilds'] = current_builds
result['state'] = self.getState()[0]
result['pendingBuilds'] = len(self.getPendingBuilds())
result['pendingBuilds'] = len(self.getPendingBuildRequestStatuses())
return result

11 changes: 5 additions & 6 deletions master/buildbot/status/web/builder.py
Expand Up @@ -76,7 +76,7 @@ def content(self, req, cxt):
cxt['current'] = [self.builder(x, req) for x in b.getCurrentBuilds()]

cxt['pending'] = []
for pb in b.getPendingBuilds():
for pb in b.getPendingBuildRequestStatuses():
source = pb.getSourceStamp()
changes = []

Expand Down Expand Up @@ -194,7 +194,7 @@ def cancelbuild(self, req):
if request_id:
c = interfaces.IControl(self.getBuildmaster(req))
bc = c.getBuilder(self.builder_status.getName())
for build_req in bc.getPendingBuilds():
for build_req in bc.getPendingBuildRequestControls():
if cancel_all or (build_req.brid == request_id):
log.msg("Cancelling %s" % build_req)
if authz.actionAllowed('cancelPendingBuild', req, build_req):
Expand All @@ -215,12 +215,11 @@ def stopchange(self, req, auth_ok=False):

authz = self.getAuthz(req)
if request_change:
# FIXME: Please, for the love of god one day make there only be
# one getPendingBuilds() with combined status info/controls
c = interfaces.IControl(self.getBuildmaster(req))
builder_control = c.getBuilder(self.builder_status.getName())
build_controls = dict((x.brid, x) for x in builder_control.getPendingBuilds())
for build_req in self.builder_status.getPendingBuilds():
brcontrols = builder_control.getPendingBuildRequestControls()
build_controls = dict((x.brid, x) for x in brcontrols)
for build_req in self.builder_status.getPendingBuildRequestStatuses():
ss = build_req.getSourceStamp()
if not ss.changes:
continue
Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/status/web/grid.py
Expand Up @@ -86,7 +86,7 @@ def builder_cxt(self, request, builder):
cxt = { 'url': path_to_builder(request, builder),
'name': builder.getName(),
'state': state,
'n_pending': len(builder.getPendingBuilds()) }
'n_pending': len(builder.getPendingBuildRequestStatuses()) }

return cxt

Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/status/web/status_json.py
Expand Up @@ -354,7 +354,7 @@ def __init__(self, status, builder_status):

def asDict(self, request):
# buildbot.status.builder.BuilderStatus
return [b.asDict() for b in self.builder_status.getPendingBuilds()]
return [b.asDict() for b in self.builder_status.getPendingBuildRequestStatuses()]


class BuilderJsonResource(JsonResource):
Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/status/web/waterfall.py
Expand Up @@ -105,7 +105,7 @@ def getBox(self, status):
# when the builder is otherwise idle.

# are any builds pending? (waiting for a slave to be free)
pbs = self.original.getPendingBuilds()
pbs = self.original.getPendingBuildRequestStatuses()
if pbs:
text.append("%d pending" % len(pbs))
for t in upcoming:
Expand Down

0 comments on commit 74032be

Please sign in to comment.