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 in busySlaveNames:
            continue
        print '*** Using %s for next build.' % slaveBuilder.slave.name
        return slaveBuilder

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

From: users [mailto:[email protected]] On Behalf Of Greg MacDonald
Sent: Thursday, February 11, 2016 11:20 AM
To: Cipi Bad
Cc: [email protected]
Subject: Re: [[email protected]] builds per node

Thanks! I’ll give that a shot.

-Greg

From: Cipi Bad [mailto:[email protected]]
Sent: Wednesday, February 10, 2016 9:50 PM
To: Greg MacDonald
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [[email protected]] 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 
<[email protected]<mailto:[email protected]>> 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
[email protected]<mailto:[email protected]>
https://lists.buildbot.net/mailman/listinfo/users

_______________________________________________
users mailing list
[email protected]
https://lists.buildbot.net/mailman/listinfo/users

Reply via email to