avoid that builders will run at the same time in buildbot
Asked Answered
A

1

1

I need to get data from a server, and this takes time; usually 30 min or more.

I have a builder that gets data from this server; I would like that no other builders on this slave, will run, if I am still running this builder. Once done, the other builder can run concurrently, respecting my settings related to the max concurrent build.

How do I achieve this? I was looking at locks, but the manual does not have a clear example that show how do I setup a builder to block all the others until is done.

Does anyone has an example that I can use to setup my configuration, and where every piece goes? Thanks

Acerbity answered 26/5, 2014 at 2:25 Comment(0)
M
2

A lock example would be:

import sys
from buildbot import locks
build_lock = locks.SlaveLock("slave_builds",
                             maxCount=sys.maxint)

c['builders'].append(BuilderConfig(name=exclusive_builder,
                                   slavenames=['my_slave'],
                                   factory=my_factory,
                                   locks=[build_lock.access('exclusive')]))
c['builders'].append(BuilderConfig(name=other_builder,
                                   slavenames=['my_slave'],
                                   factory=my_other_factory,
                                   locks=[build_lock.access('counting')]))

A build with this lock will have exclusive access to the slave. There are not badly explained, more complex examples in Interlocks section of the documentation

Mazuma answered 26/5, 2014 at 9:43 Comment(5)
Thanks Hitwen, finally a clear example of how does it look like when you want to put a lock on a builder, not on a database. Altho it seems that the lock is not honored; I added the locks line in my builder that must have exclusive access until done, and restarted (no errors), but if that builder with the lock is running, I still see other builders running at the same time. Should I look for something specifically on the logs?Acerbity
try setting maxCount=sys.maxint in the lock definition and adding locks=[build_lock.access('counting')] to the rest of the builders that run in the same slave. If that does not work you will probably have to ask in the mailing listMazuma
So, it seems that if I put the lock only on the builder that I want to run solo, it won't work. If I add also the counting on all the other builder, and set it to 1, it works. Not sure if this is the expected behavior, but it is honoring the locks now (which is not to me; I would expect that I need to point out which builder has the lock; while the others can run simultaneously). Thanks a lot!Acerbity
Seems that builders that do not use the lock simply ignore itMazuma
yup,to me it makes very little sense, why it is not respecting the locks. Logic would dictate that you just need to specify which builder or step has a lock, while the others, will obey to the max concurrent build parameter in the config file.Acerbity

© 2022 - 2024 — McMap. All rights reserved.