[Buildbot-commits] buildbot/buildbot/slave bot.py,1.15,1.16
    Brian Warner 
    warner at users.sourceforge.net
       
    Fri Oct 14 19:42:42 UTC 2005
    
        - Previous message (by thread): [Buildbot-commits] buildbot/buildbot/test runutils.py,1.2,1.3 test_locks.py,1.1,1.2 test_config.py,1.25,1.26 test_scheduler.py,1.5,1.6 test_run.py,1.34,1.35 test_slaves.py,1.1,1.2
- Next message (by thread): [Buildbot-commits] buildbot/buildbot/status client.py,1.23,1.24 html.py,1.68,1.69 words.py,1.40,1.41 builder.py,1.67,1.68
-  Messages sorted by: 
              [ date ]
              [ thread ]
              [ subject ]
              [ author ]
         
  
Update of /cvsroot/buildbot/buildbot/buildbot/slave
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32254/buildbot/slave
Modified Files:
	bot.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-326
Creator:  Brian Warner <warner at lothar.com>
implement multiple slaves per Builder, allowing concurrent Builds
	* lots: implement multiple slaves per Builder, which means multiple
	current builds per Builder. Some highlights:
	* buildbot/interfaces.py (IBuilderStatus.getState): return a tuple
	of (state,currentBuilds) instead of (state,currentBuild)
	(IBuilderStatus.getCurrentBuilds): replace getCurrentBuild()
	(IBuildStatus.getSlavename): new method, so you can tell which
	slave got used. This only gets set when the build completes.
	(IBuildRequestStatus.getBuilds): new method
	* buildbot/process/builder.py (SlaveBuilder): add a .state
	attribute to track things like ATTACHING and IDLE and BUILDING,
	instead of..
	(Builder): .. the .slaves attribute here, which has been turned
	into a simple list of available slaves. Added a separate
	attaching_slaves list to track ones that are not yet ready for
	builds.
	(Builder.fireTestEvent): put off the test-event callback for a
	reactor turn, to make tests a bit more consistent.
	(Ping): cleaned up the slaveping a bit, now it disconnects if the
	ping fails due to an exception. This needs work, I'm worried that
	a code error could lead to a constantly re-connecting slave.
	Especially since I'm trying to move to a distinct remote_ping
	method, separate from the remote_print that we currently use.
	(BuilderControl.requestBuild): return a convenience Deferred that
	provides an IBuildStatus when the build finishes.
	(BuilderControl.ping): ping all connected slaves, only return True
	if they all respond.
	* buildbot/slave/bot.py (BuildSlave.stopService): stop trying to
	reconnect when we shut down.
	* buildbot/status/builder.py: implement new methods, convert
	one-build-at-a-time methods to handle multiple builds
	* buildbot/status/*.py: do the same in all default status targets
	* buildbot/status/html.py: report the build's slavename in the
	per-Build page, report all buildslaves on the per-Builder page
	* buildbot/test/test_run.py: update/create tests
	* buildbot/test/test_slaves.py: same
	* buildbot/test/test_scheduler.py: remove stale test
	* docs/buildbot.texinfo: document the new builder-specification
	'slavenames' parameter
Index: bot.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/slave/bot.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- bot.py	7 Oct 2005 18:45:41 -0000	1.15
+++ bot.py	14 Oct 2005 19:42:39 -0000	1.16
@@ -101,7 +101,27 @@
         self.remote = remote
         self.remote.notifyOnDisconnect(self.lostRemote)
     def remote_print(self, message):
-        log.msg("builder '%s' message from master:" % self.name, message)
+        log.msg("SlaveBuilder.remote_print(%s): message from master: %s" %
+                (self.name, message))
+        if message == "ping":
+            return self.remote_ping()
+
+    def remote_ping(self):
+        log.msg("SlaveBuilder.remote_ping(%s)" % self)
+        if self.bot and self.bot.parent:
+            debugOpts = self.bot.parent.debugOpts
+            if debugOpts.get("stallPings"):
+                log.msg(" debug_stallPings")
+                timeout, timers = debugOpts["stallPings"]
+                d = defer.Deferred()
+                t = reactor.callLater(timeout, d.callback, None)
+                timers.append(t)
+                return d
+            if debugOpts.get("failPingOnce"):
+                log.msg(" debug_failPingOnce")
+                class FailPingError(pb.Error): pass
+                del debugOpts['failPingOnce']
+                raise FailPingError("debug_failPingOnce means we should fail")
 
     def lostRemote(self, remote):
         log.msg("lost remote")
@@ -120,7 +140,7 @@
         creates a new SlaveBuild object, which holds slave-side state from
         one step to the next."""
         self.build = SlaveBuild(self)
-        log.msg("startBuild")
+        log.msg("%s.startBuild" % self)
 
     def remote_startCommand(self, stepref, stepId, command, args):
         """
@@ -426,9 +446,20 @@
 class BuildSlave(service.MultiService):
     botClass = Bot
 
+    # debugOpts is a dictionary used during unit tests.
+
+    # debugOpts['stallPings'] can be set to a tuple of (timeout, []). Any
+    # calls to remote_print will stall for 'timeout' seconds before
+    # returning. The DelayedCalls used to implement this are stashed in the
+    # list so they can be cancelled later.
+
+    # debugOpts['failPingOnce'] can be set to True to make the slaveping fail
+    # exactly once.
+
     def __init__(self, host, port, name, passwd, basedir, keepalive,
-                 usePTY, keepaliveTimeout=30):
+                 usePTY, keepaliveTimeout=30, debugOpts={}):
         service.MultiService.__init__(self)
+        self.debugOpts = debugOpts.copy()
         bot = self.botClass(basedir, usePTY)
         bot.setServiceParent(self)
         self.bot = bot
@@ -450,6 +481,7 @@
 
     def stopService(self):
         self.bf.continueTrying = 0
+        self.bf.stopTrying()
         service.MultiService.stopService(self)
         # now kill the TCP connection
         # twisted >2.0.1 does this for us, and leaves _connection=None
    
    
        
	- Previous message (by thread): [Buildbot-commits] buildbot/buildbot/test runutils.py,1.2,1.3 test_locks.py,1.1,1.2 test_config.py,1.25,1.26 test_scheduler.py,1.5,1.6 test_run.py,1.34,1.35 test_slaves.py,1.1,1.2
- Next message (by thread): [Buildbot-commits] buildbot/buildbot/status client.py,1.23,1.24 html.py,1.68,1.69 words.py,1.40,1.41 builder.py,1.67,1.68
-  Messages sorted by: 
              [ date ]
              [ thread ]
              [ subject ]
              [ author ]
         
More information about the Commits
mailing list