[buildbot] phase1: prioritize builders by branch order
LEDE Commits
lede-commits at lists.infradead.org
Mon May 15 08:39:43 PDT 2023
ynezz pushed a commit to buildbot.git, branch master:
https://git.openwrt.org/d86ad1742e6e1f705d9a0491162db1c82c0e4d9f
commit d86ad1742e6e1f705d9a0491162db1c82c0e4d9f
Author: Thibaut VARÈNE <hacks at slashdirt.org>
AuthorDate: Thu Oct 27 13:27:56 2022 +0200
phase1: prioritize builders by branch order
Signed-off-by: Thibaut VARÈNE <hacks at slashdirt.org>
---
phase1/master.cfg | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/phase1/master.cfg b/phase1/master.cfg
index ee250e3..0bb23b2 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -205,11 +205,17 @@ def getNewestCompleteTime(bldr):
@defer.inlineCallbacks
def prioritizeBuilders(master, builders):
"""Returns sorted list of builders by their last timestamp of completed and
- not skipped build.
+ not skipped build, ordered first by branch name.
@returns: list of sorted builders
"""
+ bldrNamePrio = { "__Janitor": 0, "00_force_build": 0 }
+ i = 1
+ for bname in branchNames:
+ bldrNamePrio[bname] = i
+ i += 1
+
def is_building(bldr):
return bool(bldr.building) or bool(bldr.old_building)
@@ -221,10 +227,11 @@ def prioritizeBuilders(master, builders):
def bldr_sort(item):
(complete_at, bldr) = item
- if bldr.name == "00_force_build":
- date = datetime.min
- complete_at = date.replace(tzinfo=tzutc())
- return (complete_at, bldr.name)
+ pos = 99
+ for (name, prio) in bldrNamePrio.items():
+ if bldr.name.startswith(name):
+ pos = prio
+ break
if not complete_at:
date = datetime.min
@@ -234,7 +241,7 @@ def prioritizeBuilders(master, builders):
date = datetime.max
complete_at = date.replace(tzinfo=tzutc())
- return (complete_at, bldr.name)
+ return (pos, complete_at, bldr.name)
results = yield defer.gatherResults([bldr_info(bldr) for bldr in builders])
results.sort(key=bldr_sort)
@@ -513,11 +520,6 @@ def GetNextBuild(builder, requests):
# order tagged build first
if r.properties.hasProperty("tag"):
return r
- # then order by branch order
- pbranch = r.properties.getProperty("branch")
- for name in branchNames:
- if pbranch == name:
- return r
r = requests[0]
log.msg("GetNextBuild: {:>20} id: {} bsid: {}".format(builder.name, r.id, r.bsid))
More information about the lede-commits
mailing list