Skip to content

Commit 65fa367

Browse files
authored
Use canStartBuild rather than nextBuild for avoiding perf runs (#584)
There is some evidence that a delay in nextBuild can leak to unrelated workers. Switch to canStartBuild, whose docs show an example to put the worker in “quarantine” and avoid the quarantine's exponential backoff mechanism.
1 parent 6ab531a commit 65fa367

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

master/master.cfg

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -223,21 +223,21 @@ def get_delay(now, end):
223223
def no_builds_between(start, end):
224224
start = datetime.strptime(start, "%H:%M").time()
225225
end = datetime.strptime(end, "%H:%M").time()
226-
def f(builder, requests):
226+
def canStartBuild(builder, wfb, request):
227227
now = datetime.now().time()
228228
if is_within_time_range(now, start, end):
229229
delay = get_delay(now, end)
230-
# Schedule the build later
231-
deferred = defer.Deferred()
232-
builder.master.reactor.callLater(
233-
int(delay),
234-
deferred.callback,
235-
requests[0],
236-
)
237-
return deferred
230+
# Adapted from: https://docs.buildbot.net/current/manual/customization.html#canstartbuild-functions
231+
wfb.worker.quarantine_timeout = delay
232+
wfb.worker.putInQuarantine()
233+
# This does not take the worker out of quarantine, it only resets
234+
# the timeout value to default (restarting the default
235+
# exponential backoff)
236+
wfb.worker.resetQuarantine()
237+
return False
238238
# Schedule the build now
239-
return requests[0]
240-
return f
239+
return True
240+
return canStartBuild
241241

242242

243243
github_status_builders = []
@@ -323,7 +323,7 @@ for branch_num, (git_url, branchname, git_branch) in enumerate(git_branches):
323323
# This worker runs pyperformance at 12am. If a build is scheduled between
324324
# 10pm and 2am, it will be delayed at 2am.
325325
if worker_name == "diegorusso-aarch64-bigmem":
326-
builder.nextBuild = no_builds_between("22:00", "2:00")
326+
builder.canStartBuild = no_builds_between("22:00", "2:00")
327327

328328
c["builders"].append(builder)
329329

@@ -392,7 +392,7 @@ for name, worker_name, buildfactory, stability, tier in BUILDERS:
392392
# This worker runs pyperformance at 12am. If a build is scheduled between
393393
# 10pm and 2am, it will be delayed at 2am.
394394
if worker_name == "diegorusso-aarch64-bigmem":
395-
builder.nextBuild = no_builds_between("22:00", "2:00")
395+
builder.canStartBuild = no_builds_between("22:00", "2:00")
396396

397397
c["builders"].append(builder)
398398

0 commit comments

Comments
 (0)