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

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

Our users would like try builders to have high priority.
This looks like the way to do it:

Evidently using it is not trivial, though.
Mozilla uses it, and had some trouble:
Chromium used it, and had some trouble:

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

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()
      log.msg("Exception prioritizing builders; presorting failed")
    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