Skip to content

Commit

Permalink
Add ability to pause build-slaves.
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Prince <tom.prince@ualberta.net>
  • Loading branch information
tomprince committed May 14, 2011
1 parent a389b08 commit 134d355
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions master/buildbot/buildslave.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class AbstractBuildSlave(pb.Avatar, service.MultiService):
implements(IBuildSlave)
keepalive_timer = None
keepalive_interval = None
paused = False

def __init__(self, name, password, max_builds=None,
notify_on_missing=[], missing_timeout=3600,
Expand Down Expand Up @@ -481,6 +482,10 @@ def canStartBuild(self):
can start a build. This function can be used to limit overall
concurrency on the buildslave.
"""

if self.paused:
return False

# If we're waiting to shutdown gracefully, then we shouldn't
# accept any new jobs.
if self.slave_status.getGraceful():
Expand Down Expand Up @@ -597,6 +602,13 @@ def maybeShutdown(self):
d = self.shutdown()
d.addErrback(log.err, 'error while shutting down slave')

def pause(self):
"""Stop running new builds on the slave."""
self.paused = True
def unpause(self):
"""Restart running new builds on the slave."""
self.paused = False

class BuildSlave(AbstractBuildSlave):

def sendBuilderList(self):
Expand Down

0 comments on commit 134d355

Please sign in to comment.