Package buildbot :: Package schedulers :: Module base :: Class BaseScheduler
[frames] | no frames]

Class BaseScheduler

source code

 twisted.application.service.Service --+    
                                       |    
twisted.application.service.MultiService --+
                                           |
                    util.ComparableMixin --+
                                           |
                                          BaseScheduler
Known Subclasses:

Base class for all schedulers; this provides the equipment to manage reconfigurations and to handle basic scheduler state. It also provides utility methods to begin various sorts of builds.

Subclasses should add any configuration-derived attributes to base.Scheduler.compare_attrs.

Nested Classes
  Thunk
Instance Methods
 
__init__(self, name, builderNames, properties)
Initialize a Scheduler.
source code
 
startService(self) source code
 
stopService(self) source code
 
getState(self, key, default=<class buildbot.schedulers.base.Thunk at 0x3264598>)
For use by subclasses; get a named state value from the scheduler's state, defaulting to DEFAULT; raises KeyError if default is not given and no value exists.
source code
 
setState(*args, **kwargs)
For use by subclasses; set a named state value in the scheduler's persistent state.
source code
 
listBuilderNames(self)
Returns the list of builder names
source code
 
getPendingBuildTimes(self)
Returns a list of the next times that builds are scheduled, if known.
source code
 
startConsumingChanges(self, fileIsImportant=None, change_filter=None, onlyImportant=False)
Subclasses should call this method from startService to register to receive changes.
source code
 
gotChange(self, change, important)
Called when a change is received; returns a Deferred.
source code
 
addBuildsetForLatest(self, reason='', external_idstring=None, branch=None, repository='', project='', builderNames=None, properties=None)
Add a buildset for the 'latest' source in the given branch, repository, and project.
source code
 
addBuildsetForChanges(self, reason='', external_idstring=None, changeids=[], builderNames=None, properties=None)
Add a buildset for the combination of the given changesets, creating a sourcestamp based on those changes.
source code
 
addBuildsetForSourceStamp(self, ssid, reason='', external_idstring=None, properties=None, builderNames=None)
Add a buildset for the given, already-existing sourcestamp.
source code

Inherited from twisted.application.service.MultiService: __iter__, __provides__, addService, getServiceNamed, privilegedStartService, removeService

Inherited from twisted.application.service.Service: __getstate__, __providedBy__, disownServiceParent, setName, setServiceParent

Inherited from util.ComparableMixin: __cmp__, __hash__

Class Variables
  compare_attrs = ('name', 'builderNames', 'properties')

Inherited from twisted.application.service.MultiService: __implemented__

Inherited from twisted.application.service.Service: parent, running

Instance Variables
  name
name of this scheduler; used to identify replacements on reconfig
  builderNames
list of builder names to start in each buildset
  properties
properties that are contributed to each buildset
  schedulerid
ID of this scheduler; set just before the scheduler starts, and set to None after stopService is complete.
  master
BuildMaster instance; set just before the scheduler starts, and set to None after stopService is complete.
Method Details

__init__(self, name, builderNames, properties)
(Constructor)

source code 

Initialize a Scheduler.

Parameters:
  • name (unicode) - name of this scheduler (used as a key for state)
  • builderNames (list of unicode) - list of builders this scheduler may start
  • properties (dictionary) - properties to add to builds triggered by this scheduler
  • consumeChanges (boolean) - true if this scheduler wishes to be informed about the addition of new changes. Defaults to False. This should be passed explicitly from subclasses to indicate their interest in consuming changes.
Overrides: twisted.application.service.MultiService.__init__

startService(self)

source code 
Overrides: twisted.application.service.Service.startService

stopService(self)

source code 
Overrides: twisted.application.service.Service.stopService

getState(self, key, default=<class buildbot.schedulers.base.Thunk at 0x3264598>)

source code 

For use by subclasses; get a named state value from the scheduler's state, defaulting to DEFAULT; raises KeyError if default is not given and no value exists. Scheduler must be started. Returns the value via a deferred.

setState(*args, **kwargs)

source code 

For use by subclasses; set a named state value in the scheduler's persistent state. Note that value must be json-able. Returns a Deferred.

Note that this method is safe if called simultaneously in the same process, although it is not safe between processes.

Decorators:
  • @util.deferredLocked('_state_lock')

startConsumingChanges(self, fileIsImportant=None, change_filter=None, onlyImportant=False)

source code 

Subclasses should call this method from startService to register to receive changes. The BaseScheduler class will take care of filtering the changes (using change_filter) and (if fileIsImportant is not None) classifying them. See gotChange. Returns a Deferred.

Parameters:
  • fileIsImportant (callable) - a callable provided by the user to distinguish important and unimportant changes
  • change_filter (buildbot.changes.filter.ChangeFilter instance) - a filter to determine which changes are even considered by this scheduler, or None to consider all changes
  • onlyImportant (boolean) - If True, only important changes, as specified by fileIsImportant, will be added to the buildset.

gotChange(self, change, important)

source code 

Called when a change is received; returns a Deferred. If the fileIsImportant parameter to startConsumingChanges was None, then all changes are considered important.

Parameters:
  • change (buildbot.changes.changes.Change instance) - the new change object
  • important (boolean) - true if this is an important change, according to fileIsImportant.
Returns:
Deferred

addBuildsetForLatest(self, reason='', external_idstring=None, branch=None, repository='', project='', builderNames=None, properties=None)

source code 

Add a buildset for the 'latest' source in the given branch, repository, and project. This will create a relative sourcestamp for the buildset.

This method will add any properties provided to the scheduler constructor to the buildset, and will call the master's addBuildset method with the appropriate parameters.

Parameters:
  • reason (unicode string) - reason for this buildset
  • external_idstring - external identifier for this buildset, or None
  • branch - branch to build (note that None often has a special meaning)
  • repository - repository name for sourcestamp
  • project - project name for sourcestamp
  • builderNames - builders to name in the buildset (defaults to self.builderNames)
  • properties (buildbot.process.properties.Properties) - a properties object containing initial properties for the buildset
Returns:
(buildset ID, buildrequest IDs) via Deferred

addBuildsetForChanges(self, reason='', external_idstring=None, changeids=[], builderNames=None, properties=None)

source code 

Add a buildset for the combination of the given changesets, creating a sourcestamp based on those changes. The sourcestamp for the buildset will reference all of the indicated changes.

This method will add any properties provided to the scheduler constructor to the buildset, and will call the master's addBuildset method with the appropriate parameters.

Parameters:
  • reason (unicode string) - reason for this buildset
  • external_idstring - external identifier for this buildset, or None
  • changeids - nonempty list of changes to include in this buildset
  • builderNames - builders to name in the buildset (defaults to self.builderNames)
  • properties (buildbot.process.properties.Properties) - a properties object containing initial properties for the buildset
Returns:
(buildset ID, buildrequest IDs) via Deferred

addBuildsetForSourceStamp(self, ssid, reason='', external_idstring=None, properties=None, builderNames=None)

source code 

Add a buildset for the given, already-existing sourcestamp.

This method will add any properties provided to the scheduler constructor to the buildset, and will call the master's BuildMaster.addBuildset method with the appropriate parameters, and return the same result.

Parameters:
  • reason (unicode string) - reason for this buildset
  • external_idstring - external identifier for this buildset, or None
  • properties (buildbot.process.properties.Properties) - a properties object containing initial properties for the buildset
  • builderNames - builders to name in the buildset (defaults to self.builderNames)
Returns:
(buildset ID, buildrequest IDs) via Deferred