[Buildbot-devel] Prioritize slaves with nextSlave not working

Jared Grubb jared.grubb at gmail.com
Fri May 9 03:32:46 UTC 2014


What version of buildbot are you using?

I also think that;
   slave.slavename
needs to be:
   slave.slave.slavename

It's weird, but I think the list is a list-of-SlaveBuilder, and that has a BuildSlave (slave.slave), which has a name (slave.slave.slavename).

You might not be seeing anything in your twistd.log becuase you're probably raising an exception.

I would recommend wrapping the interior of your nextSlave function by a try/except that will log in the except case. Will help you find bugs :)


On May 8, 2014, at 0:58, Julia S.S. <hithwen at gmail.com> wrote:

> Hi,
> 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) < len(host.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')
>     else:
>         log.msg('launching build in host-slave')
>     return host
> 
> And then passed it to BuilderConfig. The result is that I get this in twistd.log:
> 
> 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 result.
> 
> How can I solve/debug this issue?
> 
> Thanks 
> 
> Sent with MailTrack
> 
> ------------------------------------------------------------------------------
> Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
> • 3 signs your SCM is hindering your productivity
> • Requirements for releasing software faster
> • Expert tips and advice for migrating your SCM now
> http://p.sf.net/sfu/perforce_______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20140508/ff11a578/attachment.html>


More information about the devel mailing list