Using the correct methods worked great. ☺ Exceptions aren’t being reported 
though.

def getNextSlaveIfIdle(builder, slaveBuilders, buildRequest):
    try:
        master = builder.master

        busySlaveNames = set()
        for builder in master.botmaster.builders.values():
            for b in builder.building:
                busySlaveNames.add(b.getSlaveName())

        for slaveBuilder in slaveBuilders:
            if slaveBuilder.slave.name in busySlaveNames:
                continue
            return slaveBuilder

        return None
    except Exception, e:
        log.msg(str(e))

From: users [mailto:users-boun...@buildbot.net] On Behalf Of Greg MacDonald
Sent: Friday, February 12, 2016 10:42 AM
To: Pierre Tardy; Cipi Bad
Cc: users@buildbot.net
Subject: Re: [us...@bb.net] builds per node

I am using nine. I saw that builder_status use in the code somewhere. Let me 
try again without it. Thanks! - Greg

From: Pierre Tardy [mailto:tar...@gmail.com]
Sent: Friday, February 12, 2016 9:13 AM
To: Greg MacDonald; Cipi Bad
Cc: users@buildbot.net<mailto:users@buildbot.net>
Subject: Re: [us...@bb.net] builds per node

I though you were using buildbot nine?
In that case you should not use the builder_status.

If you are in eight then any stuff you do with status, you will need to rewrite 
with nine.

nextBuild and nextSlave are still there, but with a slightly different api.


Le ven. 12 févr. 2016 à 02:04, Greg MacDonald 
<gmacdon...@trionworlds.com<mailto:gmacdon...@trionworlds.com>> a écrit :
So as a test I created a nextSlave function to allow a job only if the slave is 
idle. It sort of works except when getNext is called back to back. In that case 
I get two builds scheduled on one machine when there should only be one. It 
looks like the builder’s current builds hasn’t had time to be updated. Is there 
a lock I could use? Or a pending builds list somewhere?

Thx.

def getNextSlaveIfIdle(builder, slaveBuilders, buildRequest):
    master = builder.master

    busySlaveNames = set()
    for builder in master.botmaster.builders.values():
        for b in builder.builder_status.getCurrentBuilds():
            busySlaveNames.add(b.getSlavename())

    for slaveBuilder in slaveBuilders:
        if slaveBuilder.slave.name<http://slaveBuilder.slave.name> in 
busySlaveNames:
            continue
        print '*** Using %s for next build.' % 
slaveBuilder.slave.name<http://slaveBuilder.slave.name>
        return slaveBuilder

    print '*** No slaves available.'
    return None

From: users 
[mailto:users-boun...@buildbot.net<mailto:users-boun...@buildbot.net>] On 
Behalf Of Greg MacDonald
Sent: Thursday, February 11, 2016 11:20 AM
To: Cipi Bad

Cc: users@buildbot.net<mailto:users@buildbot.net>
Subject: Re: [us...@bb.net<mailto:us...@bb.net>] builds per node

Thanks! I’ll give that a shot.

-Greg

From: Cipi Bad [mailto:cipi...@gmail.com]
Sent: Wednesday, February 10, 2016 9:50 PM
To: Greg MacDonald
Cc: users@buildbot.net<mailto:users@buildbot.net>
Subject: Re: [us...@bb.net<mailto:us...@bb.net>] builds per node

Hi,

The solution should be in custom nextSlave function.

For similar problem, I tried to use custom nextSlave(that should be the natural 
solution)  without success.
Currently I am using a 'ugly' combination of "nextBuild" /max_builds

Good luck,
Ciprian

On Thu, Feb 11, 2016 at 2:11 AM, Greg MacDonald 
<gmacdon...@trionworlds.com<mailto:gmacdon...@trionworlds.com>> wrote:
Hi Everyone,

Is there a way to limit the number of builds per node for a set of builders? 
I’m using a slave lock for that purpose on the builder and it’s not quite what 
I’d like to happen. The builds start on a specific slave in the starting state. 
But they’re waiting not starting and it makes it difficult in the UI to see 
what is currently running. Also I’d rather the scheduling be performed 
dynamically at the time slaves become free. Is there another way to do this?

-Greg

_______________________________________________
users mailing list
users@buildbot.net<mailto:users@buildbot.net>
https://lists.buildbot.net/mailman/listinfo/users

_______________________________________________
users mailing list
users@buildbot.net<mailto:users@buildbot.net>
https://lists.buildbot.net/mailman/listinfo/users
_______________________________________________
users mailing list
users@buildbot.net
https://lists.buildbot.net/mailman/listinfo/users

Reply via email to