Package buildbot :: Package process :: Module builder :: Class Builder
[frames | no frames]

Class Builder

Jellyable --+        
            |        
 Serializable --+    
                |    
    Referenceable --+
                    |
                   Builder


I manage all Builds of a given type.

Each Builder is created by an entry in the config file (the c['builders'] list), with a number of parameters.

One of these parameters is the buildbot.process.factory.BuildFactory object that is associated with this Builder. The factory is responsible for creating new Build objects. Each Build object defines when and how the build is performed, so a new Factory or Builder should be defined to control this behavior.

The Builder holds on to a number of base.BuildRequest objects in a list named .buildable. Incoming BuildRequest objects will be added to this list, or (if possible) merged into an existing request. When a slave becomes available, I will use my BuildFactory to turn the request into a new Build object. The BuildRequest is forgotten, the Build goes into .building while it runs. Once the build finishes, I will discard it.

I maintain a list of available SlaveBuilders, one for each connected slave that the slavenames parameter says we can use. Some of these will be idle, some of them will be busy running builds for me. If there are multiple slaves, I can run multiple builds at once.

I also manage forced builds, progress expectation (ETA) management, and some status delivery chores.

I am persisted in BASEDIR/BUILDERNAME/builder, so I can remember how long a build usually takes to run (in my expectations attribute). This pickle also includes the buildbot.status.builder.BuilderStatus object, which remembers the set of historic builds.
Method Summary
  __init__(self, setup, builder_status)
  __getstate__(self)
  __repr__(self)
  __setstate__(self, d)
twisted.internet.defer.Deferred attached(self, slave, remote, commands)
This is invoked by the BotPerspective when the self.slavename bot registers their builder.
  buildFinished(self, build, sb)
This is called when the Build has finished (either success or failure).
  cancelBuildRequest(self, req)
  compareToSetup(self, setup)
  consumeTheSoulOfYourPredecessor(self, old)
Suck the brain out of an old Builder.
  detached(self, slave)
This is called when the connection to the bot is lost.
  fireTestEvent(self, name, with)
  maybeStartBuild(self)
  setBotmaster(self, botmaster)
  setExpectations(self, progress)
Mark the build as successful and update expectations for the next build.
  shutdownSlave(self)
  startBuild(self, build, sb)
Start a build on the given slave.
  submitBuildRequest(self, req)
  updateBigStatus(self)
    Inherited from Referenceable
  jellyFor(self, jellier)
(internal)
  remoteMessageReceived(self, broker, message, args, kw)
A remote message has been received.
    Inherited from Serializable
  processUniqueID(self)
Return an ID which uniquely represents this object for this process.
    Inherited from Jellyable
  getStateFor(self, jellier)

Instance Variable Summary
list of buildbot.process.base.BuildRequest buildable: BuildRequests that are ready to build, but which are waiting for a buildslave to be available.
list of buildbot.process.base.Build building: Builds that are actively running

Class Variable Summary
Implements __implemented__ = <implementedBy buildbot.process.builde...
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...
NoneType expectations = None                                                                  
int START_BUILD_TIMEOUT = 10                                                                    
    Inherited from Referenceable
NoneType perspective = None                                                                  
    Inherited from Jellyable
ClassProvides __providedBy__ = <zope.interface.declarations.ClassProvi...

Method Details

__init__(self, setup, builder_status)
(Constructor)

Parameters:
setup - builder setup data, as stored in BuildmasterConfig['builders']. Contains name, slavename(s), builddir, factory, locks.
           (type=dict)
builder_status
           (type=buildbot.status.builder.BuilderStatus)

attached(self, slave, remote, commands)

This is invoked by the BotPerspective when the self.slavename bot registers their builder.
Parameters:
slave - the BotPerspective that represents the buildslave as a whole
           (type=buildbot.master.BotPerspective)
remote - a reference to the buildbot.slave.bot.SlaveBuilder
           (type=twisted.spread.pb.RemoteReference)
commands - provides the slave's version of each RemoteCommand
           (type=dict: string -> string, or None)
Returns:
a Deferred that fires (with 'self') when the slave-side builder is fully attached and ready to accept commands.
           (type=twisted.internet.defer.Deferred)

buildFinished(self, build, sb)

This is called when the Build has finished (either success or failure). Any exceptions during the build are reported with results=FAILURE, not with an errback.

consumeTheSoulOfYourPredecessor(self, old)

Suck the brain out of an old Builder.

This takes all the runtime state from an existing Builder and moves it into ourselves. This is used when a Builder is changed in the master.cfg file: the new Builder has a different factory, but we want all the builds that were queued for the old one to get processed by the new one. Any builds which are already running will keep running. The new Builder will get as many of the old SlaveBuilder objects as it wants.

detached(self, slave)

This is called when the connection to the bot is lost.

setExpectations(self, progress)

Mark the build as successful and update expectations for the next build. Only call this when the build did not fail in any way that would invalidate the time expectations generated by it. (if the compile failed and thus terminated early, we can't use the last build to predict how long the next one will take).

startBuild(self, build, sb)

Start a build on the given slave.
Parameters:
build - the base.Build to start
sb - the SlaveBuilder which will host this build
Returns:
a Deferred which fires with a buildbot.interfaces.IBuildControl that can be used to stop the Build, or to access a buildbot.interfaces.IBuildStatus which will watch the Build as it runs.

Instance Variable Details

buildable

BuildRequests that are ready to build, but which are waiting for a buildslave to be available.
Type:
list of buildbot.process.base.BuildRequest

building

Builds that are actively running
Type:
list of buildbot.process.base.Build

Class Variable Details

__implemented__

Type:
Implements
Value:
<implementedBy buildbot.process.builder.Builder>                       

__provides__

Type:
ClassProvides
Value:
<zope.interface.declarations.ClassProvides object at 0x4072bc2c>       

expectations

Type:
NoneType
Value:
None                                                                  

START_BUILD_TIMEOUT

Type:
int
Value:
10                                                                    

Generated by Epydoc 2.1 on Sun Dec 10 22:04:45 2006 http://epydoc.sf.net