[Buildbot-devel] Prioritize slaves with nextSlave not working

Julia S.S. hithwen at gmail.com
Thu May 8 07:58:02 UTC 2014

I have set up a latent slave in buildbot to help avoid congestion. I've set
up my builds to run either in permanent slave or latent one. The idea is
the latent slave is waken up only when needed but the result is that
buildbot randomly selects one slave or the other so sometimes I have to
wait for the latent slave to wake even if the permanent one is idle.

I've created a nextSlave function as follows:

from twisted.python import log

def nextSlave(builder, build_slaves):
    logger.msg('nextSlave called')
    host = None
    support = None
    for slave in build_slaves:
        if slave.slavename == 'host-slave':
            host = slave
        elif slave.slavename == 'support-slave':
            support = slave
    if host and support and len(support.slave_status.runningBuilds) <
        log.msg('host-slave has many builds, launching build in support-slave')
        return support
    if not support:
        log.msg('no support slave found, launching build in host-slave')
        log.msg('launching build in host-slave')
    return host

And then passed it to BuilderConfig. The result is that I get this in

2014-04-28 11:01:45+0200 [-] added buildset 4329 to database

 But the build never starts, in the web UI it always appear as Pending and
none of the logs I've put appear in twistd.log
as that didn't work I've having a look to buildbot code, to see how it is
done by default. in file
./master/buildbot/process/buildrequestdistributor.py, class
BasicBuildChooser you have:

self.nextSlave = self.bldr.config.nextSlave
if not self.nextSlave:
    self.nextSlave = lambda _,slaves: random.choice(slaves) if slaves else None

So I've set exactly that lambda function in my BuilderConfig (just to try
if it was working) and I'm getting exactly the same build not starting

How can I solve/debug this issue?

Sent with MailTrack<https://mailtrack.io/install?source=signature&lang=en&referral=hithwen@gmail.com&idSignature=22>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20140508/d995feb2/attachment.html>

More information about the devel mailing list