Caution

Buildbot no longer supports Python 2.7 on the Buildbot master.

3.8.10. Schedulers connector

exception buildbot.db.schedulers.SchedulerAlreadyClaimedError

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

class buildbot.db.schedulers.SchedulersConnectorComponent

This class manages the state of the Buildbot schedulers. This state includes classifications of as-yet un-built changes.

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

Schedulers are identified by their schedulerid, which can be obtained from findSchedulerId.

Schedulers are represented by dictionaries with the following keys:

  • id - scheduler’s ID

  • name - scheduler’s name

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

Note that this class is conservative in determining what schedulers are inactive: a scheduler 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.

classifyChanges(objectid, classifications)
Parameters:
  • schedulerid – ID of the scheduler classifying the changes

  • classifications (dictionary) – mapping of changeid to boolean, where the boolean is true if the change is important, and false if it is unimportant

Returns:

Deferred

Record the given classifications. This method allows a scheduler to record which changes were important and which were not immediately, even if the build based on those changes will not occur for some time (e.g., a tree stable timer). Schedulers should be careful to flush classifications once they are no longer needed, using flushChangeClassifications.

flushChangeClassifications(objectid, less_than=None)
Parameters:
  • schedulerid – ID of the scheduler owning the flushed changes

  • less_than – (optional) lowest changeid that should not be flushed

Returns:

Deferred

Flush all scheduler_changes for the given scheduler, limiting to those with changeid less than less_than if the parameter is supplied.

getChangeClassifications(objectid[, branch])
Parameters:
  • schedulerid (integer) – ID of scheduler to look up changes for

  • branch (string or None (for default branch)) – (optional) limit to changes with this branch

Returns:

dictionary via Deferred

Return the classifications made by this scheduler, in the form of a dictionary mapping changeid to a boolean, just as supplied to classifyChanges.

If branch is specified, then only changes on that branch will be given. Note that specifying branch=None requests changes for the default branch, and is not the same as omitting the branch argument altogether.

findSchedulerId(name)
Parameters:

name – scheduler name

Returns:

scheduler ID via Deferred

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

setSchedulerMaster(schedulerid, masterid)
Parameters:
  • schedulerid – scheduler to set the master for

  • masterid – new master for this scheduler, or None

Returns:

Deferred

Set, or unset if masterid is None, the active master for this scheduler. 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 SchedulerAlreadyClaimedError.

getScheduler(schedulerid)
Parameters:

schedulerid – scheduler ID

Returns:

scheduler dictionary or None via Deferred

Get the scheduler dictionary for the given scheduler.

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

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

Returns:

list of scheduler dictionaries in unspecified order

Get a list of schedulers.

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

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