Combine --spawn and --priority flags #1530
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When running multiple agents on the same host, it is recommended to use the --priority flag if you want to force load to be balanced evenly across the hosts (https://buildkite.com/docs/agent/v3/prioritization).
The --spawn flag allows for easily registering multiple agents on the same host, greatly simplifying the operational overhead of running multiple agents.
However, --spawn and --priority can't be mixed.
This pull request proposes a general approach to combine the two flags to allow for the ease-of-use of --spawn and also solve the load balancing problem for which --priority is being suggested for. The solution is to automatically assign a --priority to each spawned agent based on the internal agent index.
I'm happy to contribute further to this (tests, etc.) as soon as there is a general agreement on the direction.