Update heuristing of parallel starting builds.
An executor is accepting up to twice as many starting builds as defined by the load_multiplier option. This is limited to 4 CPU/vCPU count. After that the executor is accepting only up to as many starting builds as defined by the load_multiplier (also up to half as many). Change-Id: I8cf395c41191647605ec47d1f5681dc46675546d
This commit is contained in:
committed by
Tobias Henkel
parent
35e0bc9b6e
commit
255de7646f
@@ -474,7 +474,9 @@ class TestStartingBuildsSensor(ZuulTestCase):
|
||||
sensor = StartingBuildsSensor(None, cores * 2.5, None)
|
||||
|
||||
# Then
|
||||
self.assertEqual(sensor.max_starting_builds, int(cores * 2.5 * 2))
|
||||
coefficient = 2 if multiprocessing.cpu_count() <= 4 else 1
|
||||
max_default = int(cores * 2.5 * coefficient)
|
||||
self.assertEqual(sensor.max_starting_builds, max_default)
|
||||
self.assertEqual(sensor.min_starting_builds, max(int(cores / 2), 1))
|
||||
|
||||
def test_configuration_not_exists(self):
|
||||
@@ -485,7 +487,9 @@ class TestStartingBuildsSensor(ZuulTestCase):
|
||||
sensor = StartingBuildsSensor(None, cores * 2.5, self.config)
|
||||
|
||||
# Then
|
||||
self.assertEqual(sensor.max_starting_builds, int(cores * 2.5 * 2))
|
||||
coefficient = 2 if multiprocessing.cpu_count() <= 4 else 1
|
||||
max_default = int(cores * 2.5 * coefficient)
|
||||
self.assertEqual(sensor.max_starting_builds, max_default)
|
||||
self.assertEqual(sensor.min_starting_builds, max(int(cores / 2), 1))
|
||||
|
||||
def test_configuration_override(self):
|
||||
|
||||
@@ -25,9 +25,12 @@ class StartingBuildsSensor(SensorInterface):
|
||||
def __init__(self, executor, max_load_avg, config=None):
|
||||
self.executor = executor
|
||||
|
||||
coefficient = 2 if multiprocessing.cpu_count() <= 4 else 1
|
||||
max_default = int(max_load_avg * coefficient)
|
||||
|
||||
self.max_starting_builds = get_default(
|
||||
config, 'executor', 'max_starting_builds', int(max_load_avg * 2)) \
|
||||
if config is not None else int(max_load_avg * 2)
|
||||
config, 'executor', 'max_starting_builds', max_default) \
|
||||
if config is not None else max_default
|
||||
|
||||
self.min_starting_builds = min(
|
||||
max(int(multiprocessing.cpu_count() / 2), 1),
|
||||
|
||||
Reference in New Issue
Block a user