How do I use the runner_concurrent_limits section in a pipeline as code?

Modified on Wed, 21 Jun 2023 at 03:24 PM

The runner_concurrent_limits section in a pipeline as code allows you to specify the maximum number of concurrent jobs that can be executed by specific runners. This feature is useful when you want to limit the number of jobs that can run concurrently on certain runners to manage resource usage or ensure fair distribution of workload.


Here's how you can use the runner_concurrent_limits section in your pipeline as code:


job:
  script:
    - echo "Running job"
  runner_concurrent_limits:
    - runner: "my-runner"
      limit: 2


In the above example, the job is configured to use the runner with the name "my-runner" and limit the concurrent execution to 2. This means that at most two instances of this job can run simultaneously on the "my-runner" runner.


You can define multiple runner_concurrent_limits sections to specify limits for different runners. This allows you to control the concurrency for different runners based on their capabilities or available resources.


By using the runner_concurrent_limits section, you can ensure that certain runners are not overloaded with too many concurrent jobs, which can help maintain stability and optimal performance of your pipeline. Additionally, it allows you to fine-tune the utilization of your runners and distribute the workload more effectively.


Remember that the availability of the runner_concurrent_limits feature may depend on the version of GitLab you are using. Make sure to check the GitLab documentation or release notes for the specific version you are working with to ensure compatibility.


Using the runner_concurrent_limits section in your pipeline as code, you have greater control over the concurrent execution of jobs on specific runners, allowing you to optimize resource allocation and improve the overall efficiency of your pipeline.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article