Package buildbot :: Package db :: Module buildsets :: Class BuildsetsConnectorComponent
[frames] | no frames]

Class BuildsetsConnectorComponent

source code

               object --+    
                        |    
base.DBConnectorComponent --+
                            |
                           BuildsetsConnectorComponent

A DBConnectorComponent to handle getting buildsets into and out of the database. An instance is available at master.db.buildsets.

Instance Methods
 
addBuildset(self, ssid, reason, properties, builderNames, external_idstring=None, _reactor=reactor)
Add a new Buildset to the database, along with the buildrequests for each named builder, returning the resulting bsid via a Deferred.
source code
 
completeBuildset(self, bsid, results, _reactor=reactor)
Complete a buildset, marking it with the given results and setting its completed_at to the current time.
source code
 
getBuildset(self, bsid)
Get a dictionary representing the given buildset, or None if no such buildset exists.
source code
 
getBuildsets(self, complete=None)
Get a list of buildset dictionaries (see getBuildset) matching the given criteria.
source code
 
getBuildsetProperties(self, buildsetid)
Return the properties for a buildset, in the same format they were given to addBuildset.
source code
 
subscribeToBuildset(self, schedulerid, buildsetid)
Add a row to scheduler_upstream_buildsets indicating that schedulerid is interested in buildset bsid.
source code
 
unsubscribeFromBuildset(self, schedulerid, buildsetid)
The opposite of subscribeToBuildset, this removes the subcription row from the database, rather than simply marking it as inactive.
source code
 
getSubscribedBuildsets(self, schedulerid)
Get the set of buildsets to which this scheduler is subscribed, along with the buildsets' current results.
source code

Inherited from base.DBConnectorComponent: __init__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables

Inherited from base.DBConnectorComponent: connector

Instance Variables

Inherited from base.DBConnectorComponent: db

Properties

Inherited from object: __class__

Method Details

addBuildset(self, ssid, reason, properties, builderNames, external_idstring=None, _reactor=reactor)

source code 

Add a new Buildset to the database, along with the buildrequests for each named builder, returning the resulting bsid via a Deferred. Arguments should be specified by keyword.

The return value is a tuple (bsid, brids) where bsid is the inserted buildset ID and brids is a dictionary mapping buildernames to build request IDs.

Parameters:
  • ssid (integer) - id of the SourceStamp for this buildset
  • reason (short unicode string) - reason for this buildset
  • properties (dictionary, where values are tuples of (value, source)) - properties for this buildset
  • builderNames (list of strings) - builders specified by this buildset
  • external_idstring (unicode string) - external key to identify this buildset; defaults to None
  • _reactor - for testing
Returns:
buildset ID and buildrequest IDs, via a Deferred

completeBuildset(self, bsid, results, _reactor=reactor)

source code 

Complete a buildset, marking it with the given results and setting its completed_at to the current time.

Parameters:
  • bsid (integer) - buildset ID to complete
  • results (integer) - integer result code
  • _reactor - reactor to use (for testing)
Returns:
Deferred
Raises:
  • KeyError - if the row does not exist or is already complete

getBuildset(self, bsid)

source code 

Get a dictionary representing the given buildset, or None if no such buildset exists.

The dictionary has keys bsid, external_idstring, reason, sourcestampid, submitted_at, complete, complete_at, and results. The *_at keys point to datetime objects. Use getBuildsetProperties to fetch the properties for a buildset.

Note that buildsets are not cached, as the values in the database are not fixed.

Parameters:
  • bsid - buildset ID
Returns:
dictionary as above, or None, via Deferred

getBuildsets(self, complete=None)

source code 

Get a list of buildset dictionaries (see getBuildset) matching the given criteria.

Since this method is often used to detect changed build requests, it always bypasses the cache.

Parameters:
  • complete - if True, return only complete buildsets; if False, return only incomplete buildsets; if None or omitted, return all buildsets
Returns:
list of dictionaries, via Deferred

getBuildsetProperties(self, buildsetid)

source code 

Return the properties for a buildset, in the same format they were given to addBuildset.

Note that this method does not distinguish a nonexistent buildset from a buildset with no properties, and returns {} in either case.

Parameters:
  • buildsetid - buildset ID
Returns:
dictionary mapping property name to (value, source), via Deferred

subscribeToBuildset(self, schedulerid, buildsetid)

source code 

Add a row to scheduler_upstream_buildsets indicating that schedulerid is interested in buildset bsid.

Parameters:
  • schedulerid (integer) - downstream scheduler
  • buildsetid (integer) - buildset id the scheduler is subscribing to
Returns:
Deferred

unsubscribeFromBuildset(self, schedulerid, buildsetid)

source code 

The opposite of subscribeToBuildset, this removes the subcription row from the database, rather than simply marking it as inactive.

Parameters:
  • schedulerid (integer) - downstream scheduler
  • buildsetid (integer) - buildset id the scheduler is subscribing to
Returns:
Deferred

getSubscribedBuildsets(self, schedulerid)

source code 

Get the set of buildsets to which this scheduler is subscribed, along with the buildsets' current results. This will exclude any rows marked as not active.

The return value is a list of tuples, each containing a buildset ID, a sourcestamp ID, a boolean indicating that the buildset is complete, and the buildset's result.

Parameters:
  • schedulerid (integer) - downstream scheduler
Returns:
list as described, via Deferred