Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

How to limit builds #4415

jintaeson ·

Hi,
Is there an option to adjust or limit the number of builds that can be performed simultaneously?
Also, can I set it up by per account?

  • replies 6
  • views 312
  • stars 0
SVMC_DPI ·

Check the number of builds at the pre-queue script also can resolve your case
advantages:

  • Can limit for each configuration
  • Can estimate actual user demand based on pre-queue log

disadvantages:

  • need to apply to all configurations if you only want to set it up per account
Laba42 ·

We have four build agents and experience has shown that about 13 simultaneous builds per agent can run without problems.

Then I created a resource Builds with the following settings
Node Selection = All Build Agents
Resource Count = 13

In the Master Step I ask under Node Selection

One node with specific Resource = Builds

For each build that is started, one is subtracted from the resource count.

This means that we can run a maximum of 52 simultaneous builds on 4 build agents.

Georg

drdt ·

My team experimented with putting checks in the Pre-Queue step but could not get a stable solution working. I would love to see an example.

We couldn't use resource pools because resources are machine-specific and we needed to limit the total number of builds across all machines (due to other resource limitations on our network).

robinshen ADMIN ·

The pre-queue script should be able to handle this, for instance:

groovy:
def aLimit = 1000
return system.buildEngine.getBuildRequests(null) < aLimit

It returns false if build requests in queue reaches limit to tell QB to drop the build requests.

drdt ·

I tried that; however, our workflow requires that the requests be queued until a resource comes available.
We tried that with a script that counted running builds, but it caused the entire queue to hang.

Would this work better?

def loopSeconds = 15; // time to wait between retries
while (system.buildEngine.getBuildRequests(null) >= vars.getValue( "maxRunningBuilds" )) sleep( loopSeconds * 1000 );

maxRunningBuilds would be a user-defined value.

robinshen ADMIN ·