[Buildbot-commits] buildbot/buildbot/process builder.py,1.32,1.33

Brian Warner warner at users.sourceforge.net
Thu Oct 20 22:25:31 UTC 2005

Update of /cvsroot/buildbot/buildbot/buildbot/process
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9509/buildbot/process

Modified Files:
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-344
Creator:  Brian Warner <warner at lothar.com>

clean up use of 'force build' methods

	* buildbot/interfaces.py (IBuilderControl.requestBuildSoon): new
	method specifically for use by HTML "force build" button and the
	IRC "force" command. Raises an immediate error if there are no
	slaves available.
	(IBuilderControl.requestBuild): make this just submit a build, not
	try to check for existing slaves or set up any when-finished
	Deferreds or anything.
	* buildbot/process/builder.py (BuilderControl): same
	* buildbot/status/html.py (StatusResourceBuilder.force): same
	* buildbot/status/words.py (IrcStatusBot.command_FORCE): same
	* buildbot/test/test_slaves.py: same
	* buildbot/test/test_web.py: same

Index: builder.py
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/builder.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- builder.py	14 Oct 2005 19:42:40 -0000	1.32
+++ builder.py	20 Oct 2005 22:25:29 -0000	1.33
@@ -603,7 +603,7 @@
-        warnings.warn("Please use BuilderControl.requestBuild instead",
+        warnings.warn("Please use BuilderControl.requestBuildSoon instead",
                       category=DeprecationWarning, stacklevel=1)
         # see if there is an idle slave, so we can emit an appropriate error
@@ -636,13 +636,18 @@
         return w.wait()
     def requestBuild(self, req):
-        """Submit a BuildRequest to this Builder. Returns a Deferred that
-        fires when the BuildRequest finishes, the same as doing
-        req.waitUntilFinished . This Deferred will fire with an
-        L{buildbot.interfaces.IBuildStatus} instance."""
-        d = req.waitUntilFinished()
+        """Submit a BuildRequest to this Builder."""
-        return d
+    def requestBuildSoon(self, req):
+        """Submit a BuildRequest like requestBuild, but raise a
+        L{buildbot.interfaces.NoSlaveError} if no slaves are currently
+        available, so it cannot be used to queue a BuildRequest in the hopes
+        that a slave will eventually connect. This method is appropriate for
+        use by things like the web-page 'Force Build' button."""
+        if not self.original.slaves:
+            raise interfaces.NoSlaveError
+        self.requestBuild(req)
     def getPendingBuilds(self):
         # return IBuildRequestControl objects

More information about the Commits mailing list