[Buildbot-commits] buildbot/buildbot/slave bot.py, 1.21, 1.22 commands.py, 1.70, 1.71

Brian Warner warner at users.sourceforge.net
Fri Nov 24 07:16:37 UTC 2006


Update of /cvsroot/buildbot/buildbot/buildbot/slave
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32609/buildbot/slave

Modified Files:
	bot.py commands.py 
Log Message:
[project @ reconfig no longer interrupts builds, nor does it disconnect/reconnect slaves]

Original author: warner at lothar.com
Date: 2006-11-23 21:32:36

Index: bot.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/slave/bot.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- bot.py	13 Oct 2006 09:08:25 -0000	1.21
+++ bot.py	24 Nov 2006 07:16:35 -0000	1.22
@@ -67,7 +67,7 @@
         self.not_really = not_really
 
     def __repr__(self):
-        return "<SlaveBuilder '%s'>" % self.name
+        return "<SlaveBuilder '%s' at %d>" % (self.name, id(self))
 
     def setServiceParent(self, parent):
         service.Service.setServiceParent(self, parent)
@@ -284,7 +284,9 @@
 
     def remote_setBuilderList(self, wanted):
         retval = {}
+        wanted_dirs = []
         for (name, builddir) in wanted:
+            wanted_dirs.append(builddir)
             b = self.builders.get(name, None)
             if b:
                 if b.builddir != builddir:
@@ -303,8 +305,15 @@
                 log.msg("removing old builder %s" % name)
                 self.builders[name].disownServiceParent()
                 del(self.builders[name])
+
+        for d in os.listdir(self.basedir):
+            if os.path.isdir(d):
+                if d not in wanted_dirs:
+                    log.msg("I have a leftover directory '%s' that is not "
+                            "being used by the buildmaster: you can delete "
+                            "it now" % d)
         return retval
-    
+
     def remote_print(self, message):
         log.msg("message from master:", message)
 

Index: commands.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/slave/commands.py,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- commands.py	5 Nov 2006 04:56:03 -0000	1.70
+++ commands.py	24 Nov 2006 07:16:35 -0000	1.71
@@ -970,7 +970,7 @@
 class DummyCommand(Command):
     """
     I am a dummy no-op command that by default takes 5 seconds to complete.
-    See L{buildbot.process.step.RemoteDummy}
+    See L{buildbot.steps.dummy.RemoteDummy}
     """
     
     def start(self):
@@ -1004,6 +1004,56 @@
 registerSlaveCommand("dummy", DummyCommand, command_version)
 
 
+# this maps handle names to a callable. When the WaitCommand starts, this
+# callable is invoked with no arguments. It should return a Deferred. When
+# that Deferred fires, our WaitCommand will finish.
+waitCommandRegistry = {}
+
+class WaitCommand(Command):
+    """
+    I am a dummy command used by the buildbot unit test suite. I want for the
+    unit test to tell us to finish. See L{buildbot.steps.dummy.Wait}
+    """
+    
+    def start(self):
+        self.d = defer.Deferred()
+        log.msg("  starting wait command [%s]" % self.stepId)
+        handle = self.args['handle']
+        cb = waitCommandRegistry[handle]
+        del waitCommandRegistry[handle]
+        def _called():
+            log.msg(" wait-%s starting" % (handle,))
+            d = cb()
+            def _done(res):
+                log.msg(" wait-%s finishing: %s" % (handle, res))
+                return res
+            d.addBoth(_done)
+            d.addCallbacks(self.finished, self.failed)
+        reactor.callLater(0, _called)
+        return self.d
+
+    def interrupt(self):
+        log.msg("  wait command interrupted")
+        if self.interrupted:
+            return
+        self.interrupted = True
+        self.finished("interrupted")
+
+    def finished(self, res):
+        log.msg("  wait command finished [%s]" % self.stepId)
+        if self.interrupted:
+            self.sendStatus({'rc': 2})
+        else:
+            self.sendStatus({'rc': 0})
+        self.d.callback(0)
+    def failed(self, why):
+        log.msg("  wait command failed [%s]" % self.stepId)
+        self.sendStatus({'rc': 1})
+        self.d.callback(0)
+
+registerSlaveCommand("dummy.wait", WaitCommand, command_version)
+
+
 class SourceBase(Command):
     """Abstract base class for Version Control System operations (checkout
     and update). This class extracts the following arguments from the





More information about the Commits mailing list