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.

Instance Methods
 
__init__(self, name, builderNames, properties)
Initialize a Scheduler.
source code
 
startService(self) source code
 
findNewSchedulerInstance(self, new_config) source code
 
stopService(self) source code
 
getState(*args, **kwargs)
For use by subclasses; get a named state value from the scheduler's state, defaulting to DEFAULT.
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(*args, **kwargs)
Add a buildset for the 'latest' source in the given branch, repository, and project.
source code
 
addBuildsetForChanges(*args, **kwargs)
Add a buildset for the combination of the given changesets, creating a sourcestamp based on those changes.
source code
 
addBuildsetForChangesMultiRepo(*args, **kwargs) source code
 
addBuildsetForSourceStamp(*args, **kwargs)
Add a buildset for the given, already-existing sourcestamp.
source code
 
__provides__(...)
Special descriptor for class __provides__

Inherited from twisted.application.service.MultiService: __iter__, 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')
  __implemented__ = <implementedBy buildbot.schedulers.base.Base...

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
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(*args, **kwargs)

source code 

For use by subclasses; get a named state value from the scheduler's state, defaulting to DEFAULT.

Parameters:
  • name - name of the value to retrieve
  • default - (optional) value to return if name is not present
Returns:
state value via a Deferred
Decorators:
  • @defer.deferredGenerator
Raises:
  • KeyError - if name is not present and no default is given
  • TypeError - if JSON parsing fails

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.

Parameters:
  • name - the name of the value to change
  • value - the value to set - must be a JSONable object
  • returns - Deferred
Decorators:
  • @defer.deferredGenerator
Raises:
  • TypeError - if JSONification fails

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(*args, **kwargs)

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
Decorators:
  • @defer.deferredGenerator

addBuildsetForChanges(*args, **kwargs)

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
Decorators:
  • @defer.deferredGenerator

addBuildsetForChangesMultiRepo(*args, **kwargs)

source code 
Decorators:
  • @defer.deferredGenerator

addBuildsetForSourceStamp(*args, **kwargs)

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)
  • setid - idenitification of a set of sourcestamps
Returns:
(buildset ID, buildrequest IDs) via Deferred
Decorators:
  • @defer.deferredGenerator

__provides__(...)

 
Special descriptor for class __provides__

The descriptor caches the implementedBy info, so that
we can get declarations for objects without instance-specific
interfaces a bit quicker.

For example:

  >>> from zope.interface import Interface
  >>> class IFooFactory(Interface):
  ...     pass
  >>> class IFoo(Interface):
  ...     pass
  >>> class C(object):
  ...     implements(IFoo)
  ...     classProvides(IFooFactory)
  >>> [i.getName() for i in C.__provides__]
  ['IFooFactory']

  >>> [i.getName() for i in C().__provides__]
  ['IFoo']

Overrides: util.ComparableMixin.__provides__

Class Variable Details

__implemented__

Value:
<implementedBy buildbot.schedulers.base.BaseScheduler>