Skip to content

Commit e22dfe0

Browse files
Collapse clean and non clean build requests on clean builders (#266)
Fixes #250 Where build requests were piling up on slower builders because they were clean/don't clean/clean/ don't clean etc. and we could not merge those requests because of that difference. Galina suggested that if we knew that the builder was going to clean the build first anyway, we could merge them. This commit implements that. We do this by first setting a "clean" attribute on the builder's factory object, that we can find later via in the collapse callback. So far only ClangBuilder passes this on but any builder can opt in by copying what it does. In the collapse function when comparing properties we delete the "clean_obj" key from both sets of properties if we know that the builder's factory is always clean. With some logging (not included in this commit) we can see it now collapses a clean/non-clean pair of requests: ``` collapseRequests selfBuildSetProperties: {'scheduler': ('main:clang,clang-tools-extra,compiler-rt,flang,lld,llvm,mlir', 'Scheduler')} otherBuildSetProperties: {'scheduler': ('main:clang,clang-tools-extra,compiler-rt,flang,lld,llvm,mlir', 'Scheduler'), 'clean_obj': (True, 'Change')} Removing clean_obj from build set properties. Build set properties were the same. ``` This has beeen tested by my colleague Omair Javaid on a test build master. Of course we only tested it with one of Linaro's builders, so it's possible we see other side effects in production.
1 parent c030b8d commit e22dfe0

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

zorg/buildbot/builders/ClangBuilder.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ def _getClangCMakeBuildFactory(
278278
f = LLVMBuildFactory(
279279
depends_on_projects=depends_on_projects,
280280
llvm_srcdir='llvm',
281-
enable_runtimes=enable_runtimes)
281+
enable_runtimes=enable_runtimes,
282+
clean=clean)
282283

283284
# Checkout the latest code for LNT
284285
# and the test-suite separately. Le's do this first,

zorg/buildbot/process/buildrequest.py

+8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ def collapseRequests(master, builder, req1, req2):
3131
str(req2['buildsetid'])
3232
)
3333

34+
# If the build is going to be a clean build anyway, we can collapse a clean
35+
# build and a non-clean build.
36+
if getattr(builder.config.factory, "clean", False):
37+
if 'clean_obj' in selfBuildsetPoperties:
38+
del selfBuildsetPoperties["clean_obj"]
39+
if 'clean_obj' in otherBuildsetPoperties:
40+
del otherBuildsetPoperties["clean_obj"]
41+
3442
# Check buildsets properties and do not collapse
3543
# if properties do not match. This includes the check
3644
# for different schedulers.

zorg/buildbot/process/factory.py

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ def __init__(self, steps=None, depends_on_projects=None, hint=None, **kwargs):
4040
BuildFactory.__init__(self, steps)
4141

4242
self.hint = hint
43+
44+
self.clean = kwargs.pop('clean', False)
4345

4446
# Handle the dependencies.
4547
if depends_on_projects is None:

0 commit comments

Comments
 (0)