[Buildbot-devel] Prioritize slaves with nextSlave not working

Jared Grubb jared.grubb at gmail.com
Tue May 13 06:51:31 UTC 2014


I've added a pull request to help fix up that doc there:
https://github.com/buildbot/buildbot/pull/1150

Jared

On May 12, 2014, at 7:26, Julia S.S. <hithwen at gmail.com> wrote:

> mm, seems that reconfig applies the config but does not make logs appear, after restart I start seing logs so I can debug my function. You're right about the slave builder list, the typo is reported here here but ist not fixed here. 
> 
> Thanks a lot!
> 
> Sent with MailTrack
> 
> 
> 
> On Fri, May 9, 2014 at 5:45 PM, Jared Grubb <jared.grubb at gmail.com> wrote:
> FWIW, here is one that I use:
> 
> SLAVE_PRIORITY = {
>     'slave_1': 100,
>     'slave_2': 75,
>     'slave_3': 50,
> }
> 
> def useBestSlave(bldr, buildslaves):
>     if not buildslaves:
>         return None
>     try:
>         slaves = sorted(buildslaves, key=lambda s: SLAVE_PRIORITY.get(s.slave.slavename, 0))
>         twisted_log.msg("useBestSlave: Of %d slaves, picked: %s" % (len(buildslaves), slaves[-1].slave.slavename))
>         return slaves[-1]
>     except Exception, e:
>         twisted_log.msg("useBestSlave: got exception: %r" % (e))
>         return random.choice(buildslaves)
> 
> ...
> 
> c['builders'].append({
>         'name': '...',
>         'factory': BuildFactory(steps),
>         'builddir': builddir,
>         ....,
>         'nextSlave':  useBestSlave,
>     })
> 
> 
> 
> On May 9, 2014, at 3:04, Julia S.S. <hithwen at gmail.com> wrote:
> 
>> Hi Jared,
>> I'm using 0.8.8
>> 
>> In case of exception i'd expect to see  at least the first logged message (which is the first line of the function): logger.msg('nextSlave called') and when i'm passing lambda _,slaves: random.choice(slaves) if slaves else None if should not hang anyway.
>> I gave a try to the try/catch->log but i got same result: build pending and nothing in the log.
>> 
>> Thanks anyway
>> 
>> 
>> 
>> 
>> Sent with MailTrack
>> 
> 
> 

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


More information about the devel mailing list