[users at bb.net] Prioritizing try builders with prioritizeBuilders?

Dan Kegel dank at kegel.com
Sun Mar 13 00:49:11 UTC 2016


Hi!
Our users would like try builders to have high priority.
This looks like the way to do it:
http://docs.buildbot.net/latest/manual/cfg-global.html#prioritizing-builders
http://docs.buildbot.net/latest/manual/customization.html#builder-priority-functions

Evidently using it is not trivial, though.
Mozilla uses it, and had some trouble:
https://bugzilla.mozilla.org/show_bug.cgi?id=984923
https://github.com/mozilla/build-buildbot-configs/blob/master/mozilla/master_common.py
Chromium used it, and had some trouble:
https://bugs.chromium.org/p/chromium/issues/detail?id=397087

Mozilla's prioritizeBuilders looked really complicated, but Chromium's
was relatively simple:

  from twisted.internet import defer
  from twisted.python import log
  from twisted.python.failure import Failure

@defer.deferredGenerator
def prioritizeBuilders(buildmaster, builders):
      # Presort with default sorting function of buildbot. The default sorting
      # takes the age of the latest build requests into account.
      sorter = (lambda:
          buildmaster.botmaster.brd._defaultSorter(buildmaster, builders))
      wfd = defer.waitForDeferred(defer.maybeDeferred(sorter))
      yield wfd
      builders = wfd.getResult()
    except:
      log.msg("Exception prioritizing builders; presorting failed")
      log.err(Failure())
    yield sorted(builders, key=lambda b: builder_priorities.get(b.name, 0))

where their own sort is added in the very last line; presumably in my
case I'd make a function that returned 0 for normal builds and 1
for try builds (or vice versa) and rely on sorted() to be stable.

Is that the recommended approach?  Seems like this ought to be covered
in the doc somehow.
- Dan


More information about the users mailing list