[Buildbot-devel] Why slaves locked by a builder lock are considered as available by this builder

Alberdi, IonX ionx.alberdi at intel.com
Wed Feb 15 14:24:56 UTC 2012


Hello,
I have a question regarding locks on slaves.
Indeed I'm very interesting on the feature that
enables one user to limit the number of // builds a slaves does thanks
To the SlaveLock objects. However, this feature does not exactly work as I expected.
Let us say we have two slaves, sl1, sl2, and three builders b1,b2,b3, configured like that:

slave_lock = SlaveLock("slavelock",
                       maxCountForSlave = { sl1: 2,sl2:1 })
...
Def nextSlave(builder,slavebuilders):
... if sl1 in slavebuilders:
               Return sl1
   Else:
            Return sl2

for b in b1,b2,b3:
BuilderConfig(name=b,
                          slavenames=[sl1,sl2],
                           nextSlave = nextSlave,
                           locks = [slave_lock])

Let us say we launch b1,b2 and b3 in //. In this case, the three builds will be created, and choose
sl1. However, even if created, one of the builds will be in "waiting for lock" state.
This is sad because sl2 is available and could be used to run the locked build.
My questions are therefore the followings:
. Is there a reason why the slaves locked by the builder lock are put in the available_slavebuilders list ?
(master/buildbot/process/builder.py)
available_slavebuilders = [ sb for sb in self.slaves
                                    if sb.isAvailable() ]
Indeed, the sb.isAvailable() checks that the slave is not to be locked by one of its own locks. Therefore, I wonder
Whether we could do something like:
available_slavebuilders = [ sb for sb in self.slaves
                                                 if sb.isAvailable() and self.OwnLocksdoNotLock(sb) ]

self.OwnLocksDoNoLock checking that any of the locks of the builder do not hold one slave.

. If a reason not to implement this modification exists, could you give me your advice on
the best way to implement the fact that a locked slave (by the builder lock)
Is not chosen and affected to the next build to create ?
More precisely, should I check that from:
- a nextSlave function, or
- use locks that can be set up in the BuildSlave constructor ? (from what I understood, these are the locks that are actually checked In sb.isAvailable())

Thanks in advance

--
Ion

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20120215/66de9437/attachment.html>


More information about the devel mailing list