aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-07 11:37:03 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-07 11:37:06 +0000
commit3b290ec6d72e9dc116869cf0b0a8b1937d848567 (patch)
tree54ad34d7e6bc86cdb2e36389988529cff284ff84
parent5f370fbce02d4ec4b44b5aaa14c5ae379cd6937c (diff)
downloadyocto-autobuilder2-master.tar.gz
yocto-autobuilder2-master.tar.bz2
yocto-autobuilder2-master.zip
builders: Add randomised nextBuild functionHEADmaster
nextWorker can block a request if there is no worker available. _getNextUnclaimedBuildRequest will always return the first request which then will always fail to find worker, and this will block the queue We therefore randomise the build requests queue with nextBuild to avoid blocking. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--builders.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/builders.py b/builders.py
index e3ca737..681bda3 100644
--- a/builders.py
+++ b/builders.py
@@ -215,6 +215,14 @@ def nextWorker(bldr, workers, buildrequest):
return w
return None # worker not yet available
+# nextWorker above can block a request if there is no worker available.
+# _getNextUnclaimedBuildRequest will always return the first request
+# which then will always fail to find worker, and this will block the queue
+# We therefore randomise the build requests queue with nextBuild to avoid
+# blocking
+def nextBuild(bldr, requests):
+ return random.choice(requests) if requests else None
+
# regular builders
f = create_builder_factory()
for builder in config.subbuilders:
@@ -222,7 +230,7 @@ for builder in config.subbuilders:
if not workers:
workers = config.builder_to_workers['default']
builders.append(util.BuilderConfig(name=builder,
- workernames=workers, nextWorker=nextWorker,
+ workernames=workers, nextWorker=nextWorker, nextBuild=nextBuild,
factory=f, env=extra_env))
def create_parent_builder_factory(buildername, waitname):
@@ -350,5 +358,5 @@ def create_parent_builder_factory(buildername, waitname):
return factory
-builders.append(util.BuilderConfig(name="a-quick", workernames=config.workers, factory=create_parent_builder_factory("a-quick", "wait-quick"), nextWorker=nextWorker, env=extra_env))
-builders.append(util.BuilderConfig(name="a-full", workernames=config.workers, factory=create_parent_builder_factory("a-full", "wait-full"), nextWorker=nextWorker, env=extra_env))
+builders.append(util.BuilderConfig(name="a-quick", workernames=config.workers, factory=create_parent_builder_factory("a-quick", "wait-quick"), nextWorker=nextWorker, nextBuild=nextBuild, env=extra_env))
+builders.append(util.BuilderConfig(name="a-full", workernames=config.workers, factory=create_parent_builder_factory("a-full", "wait-full"), nextWorker=nextWorker, nextBuild=nextBuild, env=extra_env))