mirror of
git://git.yoctoproject.org/yocto-autobuilder2.git
synced 2025-07-19 20:59:02 +02:00
builders/scheduler: Add ability to select the worker to run on
Thanks to tardyp for the pointer to an example of how to make this work! Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
62e4e2b174
commit
b0f684ee64
11
builders.py
11
builders.py
|
@ -7,6 +7,7 @@ from datetime import datetime
|
|||
|
||||
import os
|
||||
import json
|
||||
import random
|
||||
|
||||
|
||||
builders = []
|
||||
|
@ -189,6 +190,14 @@ def create_builder_factory():
|
|||
timeout=16200)) # default of 1200s/20min is too short, use 4.5hrs
|
||||
return f
|
||||
|
||||
def nextWorker(bldr, workers, buildrequest):
|
||||
forced_worker = buildrequest.properties.getProperty("worker", "*")
|
||||
if forced_worker == "*":
|
||||
return random.choice(workers) if workers else None
|
||||
for w in workers:
|
||||
if w.worker.workername == forced_worker:
|
||||
return w
|
||||
return None # worker not yet available
|
||||
|
||||
# regular builders
|
||||
f = create_builder_factory()
|
||||
|
@ -197,7 +206,7 @@ for builder in config.subbuilders:
|
|||
if not workers:
|
||||
workers = config.builder_to_workers['default']
|
||||
builders.append(util.BuilderConfig(name=builder,
|
||||
workernames=workers,
|
||||
workernames=workers, nextWorker=nextWorker,
|
||||
factory=f, env=extra_env))
|
||||
|
||||
def create_parent_builder_factory(buildername, waitname):
|
||||
|
|
|
@ -74,8 +74,14 @@ def props_for_builder(builder):
|
|||
label="Do we want to deploy artefacts? ",
|
||||
default=False
|
||||
))
|
||||
|
||||
props = props + repos_for_builder(builder)
|
||||
worker_list = config.builder_to_workers.get(builder, config.builder_to_workers['default'])
|
||||
props.append(util.ChoiceStringParameter(name="worker",
|
||||
label="Worker to run the build on",
|
||||
default="*",
|
||||
multiple=False,
|
||||
strict=True,
|
||||
choices=worker_list))
|
||||
return props
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user