Next: , Previous: Merging Build Requests (global option), Up: Global Configuration


4.6.7 Prioritizing Builders

By default, buildbot will attempt to start builds on builders in order from the builder with the highest priority or oldest pending request to the lowest-priority, newest request. This behaviour can be customized with the c['prioritizeBuilders'] configuration key. This key specifies a function which is called with two arguments: a BuildMaster and a list of Builder objects. It should return a list of Builder objects in the desired order. It may also remove items from the list if builds should not be started on those builders. If necessary, this function can return its results via a Deferred (it is called with maybeDeferred).

This parameter controls the order in which builders are activated. It does not affect the order in which a builder processes the build requests in its queue. For that purpose, see see Prioritizing Builds.

     def prioritizeBuilders(buildmaster, builders):
         """Prioritize builders.  'finalRelease' builds have the highest
         priority, so they should be built before running tests, or
         creating builds."""
         builderPriorities = {
             "finalRelease": 0,
             "test": 1,
             "build": 2,
         }
         builders.sort(key=lambda b: builderPriorities.get(b.name, 0))
         return builders
     
     c['prioritizeBuilders'] = prioritizeBuilders