3.8.9. Change sources connector

exception buildbot.db.changesources.ChangeSourceAlreadyClaimedError

Raised when a changesource request is already claimed by another master.

class buildbot.db.changesources.ChangeSourcesConnectorComponent

This class manages the state of the Buildbot changesources.

An instance of this class is available at master.db.changesources.

Changesources are identified by their changesourceid, which can be obtained from findChangeSourceId.

Changesources are represented by dictionaries with the following keys:

  • id - changesource’s ID

  • name - changesource’s name

  • masterid - ID of the master currently running this changesource, or None if it is inactive

Note that this class is conservative in determining what changesources are inactive: a changesource linked to an inactive master is still considered active. This situation should never occur, however; links to a master should be deleted when it is marked inactive.

findChangeSourceId(name)
Parameters:

name – changesource name

Returns:

changesource ID via Deferred

Return the changesource ID for the changesource with this name. If such a changesource is already in the database, this returns the ID. If not, the changesource is added to the database and its ID returned.

setChangeSourceMaster(changesourceid, masterid)
Parameters:
  • changesourceid – changesource to set the master for

  • masterid – new master for this changesource, or None

Returns:

Deferred

Set, or unset if masterid is None, the active master for this changesource. If no master is currently set, or the current master is not active, this method will complete without error. If the current master is active, this method will raise ChangeSourceAlreadyClaimedError.

getChangeSource(changesourceid)
Parameters:

changesourceid – changesource ID

Returns:

changesource dictionary or None, via Deferred

Get the changesource dictionary for the given changesource.

getChangeSources(active=None, masterid=None)
Parameters:
  • active (boolean) – if specified, filter for active or inactive changesources

  • masterid (integer) – if specified, only return changesources attached associated with this master

Returns:

list of changesource dictionaries in unspecified order

Get a list of changesources.

If active is given, changesources are filtered according to whether they are active (true) or inactive (false). An active changesource is one that is claimed by an active master.

If masterid is given, the list is restricted to schedulers associated with that master.