1

Here is my current situation: We have buildbot with many slaves and many (many) builders. Each slave can only run one build at a time. We have builders triggered nightly or on commit. We do not have a large number of slaves, and the builds take several hours to complete.

Here is what I try to achieve: We would like that when a builder is already running and it is triggered again, it stays pending until its previous instance finishes even though there would be a slave available for it. That would allow other builders to run in the meantime.

I have read Buildbot running sequential builders after they're finished and it does not correspond to my problem.

I have read about interlocks but I am not sure it would be helpful for my situation. http://docs.buildbot.net/current/manual/cfg-interlocks.html

I am aware of the mergeRequests argument and use it but this only applies to pending builds, not the mechanism which releases the builds from pending to running, or even earlier if the newly-triggered build is started without being pending at all.

Does anyone know how to achieve this?

Community
  • 1
  • 1
XonqNopp
  • 101
  • 8

1 Answers1

0

You are on the right path. You want a "MasterLock" which is global (whereas a "SlaveLock" is evaluated per-slave).

my_lock = locks.MasterLock("some name", maxCount=1))

And then on your builder:

BuilderConfig(..., locks=[my_lock.access('exclusive')])

Jared Grubb
  • 1,139
  • 9
  • 17
  • Hi! Thanks for the tip. I'll try this, but right now I am very busy. I'll come back here when I have time to check this ;-) – XonqNopp Jun 20 '16 at 05:43
  • Hi, back again on this topic :) So I tried this, but the slave gets blocked by the builder anyway, the difference is that it waits with the slaves blocked until the previous build is finished... Any idea how to prevent the slave being acquired before the lock is free? – XonqNopp Feb 07 '17 at 13:45