Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Priority/order for which self-hosted runner to use?

Fabregas4 December 8, 2021

Let's say I have 2 self-hosted runners available to build for my C++ projects.

One runner is on a server much more powerful than the other, so it finishes jobs faster. I'd like Bitbucket Pipelines to use this one when it's free, and only use the 2nd one on the rare occasions when the 1st is already running a job.

Is there a way to configure this, i.e. have Pipelines prioritize a runner over another? Or will Bitbucket Pipelines always randomly pick from the list of available runners?

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 9, 2021

Hello @Fabregas4 ,

Thank you for reaching out to Atlassian Community!

At this moment, there's no option on Bitbucket Runners to configure the priority/order that a runner will be chosen when there are multiple runners available.

Currently, a build step configured to use runners will run on the next available runner that has all the required labels, with the following remarks :

  • If all matching runners are busy, your step will wait until one becomes available again.

  • If you don’t have any online runners in your repository that match all labels, the step will fail.

That being said, I went ahead and raised a feature request on our public issue tracker to add the functionality to set priority/order of runners, as you can see in the following link:

I would suggest you to add your vote there, since this helps both developers and product managers to understand the interest. Also, make sure you add yourself as a watcher in case you want to receive first-hand updates from that ticket. Please note that all features are implemented with this policy in mind: https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html

Let us know if you have any other questions.

Best regards,

Patrik S

Russell Schultz February 8, 2023

Can you tell us what the current bitbucket cloud pipeline algorithm is if multiple matching runners are available?

First matching available in the list as shown in repository runners, then fall over to workspace runners and follow the same?

First matching sorted by name?  UUID?   something?

Randomly?

 

I realize this would require some code inspection on atlassian's part, but these sort of things are important and the lack of this feature is pretty maddening.

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 10, 2023

Hello @Russell Schultz ,

The way how available runners will be selected follows the logic below: 

  • get the list of repository runners in unspecified order
    • if there is more than one available repository runner, the first one will be selected
    • else, get the list of workspace runners in unspecified order
      • if there is more than one available workspace  runner, the first one will be selected

This means that repository runners have priority over workspace runners.

Thank you, @Russell Schultz !

Patrik S

Kacper Nowak October 2, 2023

This is not really accurate answere when it comes to:
"get the list of repository runners in unspecified order" 
actually the order is specific and always the same. I think the author of this question wanted to know what is the algorithm, so he can create runner that will be always first when all runner are idle.

I have the same problem, that my slower runner is always running first, then faster runner if slower is busy.

Kacper Nowak October 2, 2023

Ahh ok, accoring to my testing it seams that runners are sorted by UUID in alphabetic order, eg.:

{df082842-ac4d-5...}

{57bcfe0e-9255-5...} - This one will be running as first priority as 5 is less than d when sorting by name.

So i had to click "Add runner" until my priority runner got lower uuid  :) then remove old runner. Maybe it is a bit pathetic, but it works for me ! :)

Like Ryan Castle likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events