[Fix] Fix computation of excess workload and available capacity #371
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.
Description
The plugin computes current demand and available capacity in order to identify excess workload and provision capacity for it. This code is run when jobs are added to queues.
Problems with current computations:
connectingExecutors
andplannedCapacitySnapshot
. This can lead to availableCapacity being much higher than reality, esp. for huge fleets and a busy Jenkins with numerous builds running / queued.provisioning completed
messages after planning to provision.Context:
The plugin keeps track of new capacity planned to provision with
plannedCapacitySnapshot
, which is required to avoid over-provisioning. The plugin also controls when the Java futures for planned nodes are resolved - after Jenkins has established a connection to the new node or connection fails due to timeout i.e.plannedCapacitySnapshot
includes nodes in ‘connecting’ state.Reference of other plugins:
Related Issues:
Testing done
Tested that results match expectations with a snapshot version of the plugin with:
Sample logs:
Before:
Before: