Caution

Buildbot no longer supports Python 2.7 on the Buildbot master.

3.8.14. Masters connector

class buildbot.db.masters.MastersConnectorComponent

This class handles tracking the buildmasters in a multi-master configuration. Masters “check in” periodically. Other masters monitor the last activity times, and mark masters that have not recently checked in as inactive.

Masters are represented by master dictionaries with the following keys:

  • id – the ID of this master

  • name – the name of the master (generally of the form hostname:basedir)

  • active – true if this master is running

  • last_active – time that this master last checked in (a datetime object)

findMasterId(name)
Parameters

name (unicode) – name of this master

Returns

master id via Deferred

Return the master ID for the master with this master name (generally hostname:basedir). If such a master is already in the database, this returns the ID. If not, the master is added to the database, with active=False, and its ID returned.

setMasterState(masterid, active)
Parameters
  • masterid (integer) – the master to check in

  • active (boolean) – whether to mark this master as active or inactive

Returns

boolean via Deferred

Mark the given master as active or inactive, returning true if the state actually changed. If active is true, the last_active time is updated to the current time. If active is false, then any links to this master, such as schedulers, will be deleted.

getMaster(masterid)
Parameters

masterid (integer) – the master to check in

Returns

Master dict or None via Deferred

Get the indicated master.

getMasters()
Returns

list of Master dicts via Deferred

Get a list of the masters, represented as dictionaries; masters are sorted and paged using generic data query options

setAllMastersActiveLongTimeAgo()
Returns

None via Deferred

This method is intended to be call by upgrade-master, and will effectively force housekeeping on all masters at next startup. This method is not intended to be called outside of housekeeping scripts.