问题
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
回答1:
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
来源:https://stackoverflow.com/questions/23861906/avoid-that-builders-will-run-at-the-same-time-in-buildbot