Buildbot no longer supports Python 2.7 on the Buildbot master.

3.8.1. Buildsets connector

class buildbot.db.buildsets.BuildsetsConnectorComponent

This class handles getting buildsets into and out of the database. Buildsets combine multiple build requests that were triggered together.

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

Buildsets are indexed by bsid and their contents represented as bsdicts (buildset dictionaries), with keys

  • bsid

  • external_idstring (arbitrary string for mapping builds externally)

  • reason (string; reason these builds were triggered)

  • sourcestamps (list of sourcestamps for this buildset, by ID)

  • submitted_at (datetime object; time this buildset was created)

  • complete (boolean; true if all of the builds for this buildset are complete)

  • complete_at (datetime object; time this buildset was completed)

  • results (aggregate result of this buildset; see Build Result Codes)

addBuildset(sourcestamps, reason, properties, builderids, external_idstring=None, parent_buildid=None, parent_relationship=None)
  • sourcestamps (list) – sourcestamps for the new buildset; see below

  • reason (short unicode string) – reason for this buildset

  • properties (dictionary, where values are tuples of (value, source)) – properties for this buildset

  • builderids (list of int) – builderids specified by this buildset

  • external_idstring (unicode string) – external key to identify this buildset; defaults to None

  • submitted_at (datetime) – time this buildset was created; defaults to the current time

  • parent_buildid (int) – optional build id that is the parent for this buildset

  • parent_relationship (unicode) – relationship identifier for the parent, this is is configured relationship between the parent build, and the childs buildsets


buildset ID and buildrequest IDs, via a Deferred

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

Each sourcestamp in the list of sourcestamps can be given either as an integer, assumed to be a sourcestamp ID, or a dictionary of keyword arguments to be passed to findSourceStampId.

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

completeBuildset(bsid, results[, complete_at=XX])
  • bsid (integer) – buildset ID to complete

  • results (integer) – integer result code

  • complete_at (datetime) – time the buildset was completed




KeyError if the buildset does not exist or is already complete

Complete a buildset, marking it with the given results and setting its completed_at to the current time, if the complete_at argument is omitted.


bsid – buildset ID


bsdict, or None, via Deferred

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

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

getBuildsets(complete=None, resultSpec=None)
  • complete – if true, return only complete buildsets; if false, return only incomplete buildsets; if None or omitted, return all buildsets

  • resultSpec – resultSpec containing filters sorting and paging request from data/REST API. If possible, the db layer can optimize the SQL query using this information.


list of bsdicts, via Deferred

Get a list of bsdicts matching the given criteria.

getRecentBuildsets(count=None, branch=None, repository=None,
  • count (integer) – maximum number of buildsets to retrieve (required).

  • branch (string) – optional branch name. If specified, only buildsets affecting such branch will be returned.

  • repository (string) – optional repository name. If specified, only buildsets affecting such repository will be returned.

  • complete (Boolean) – if true, return only complete buildsets; if false, return only incomplete buildsets; if None or omitted, return all buildsets


list of bsdicts, via Deferred

Get “recent” buildsets, as defined by their submitted_at times.


bsid – buildset ID


dictionary mapping property name to value, source, via Deferred

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.