From a53e2eabe339c12bab9e4bf10155f5d1cdd250a8 Mon Sep 17 00:00:00 2001 From: Gregory Thiemonge Date: Tue, 27 Apr 2021 10:08:36 +0200 Subject: [PATCH] Fix task_flow.max_workers with persistence in amphorav2 When jobboard was enabled in amphorav2, the [task_flow]/max_workers option was unused, updating a LB with a lot of children could have failed because of dozens of concurrent connections to the database. Story 2008860 Task 42381 Change-Id: I5341949513e6eb814655ee8f14a01b061894fc34 (cherry picked from commit c5287e1b08c8ffc16bcfcb7d878dc6a652ff2834) --- octavia/common/base_taskflow.py | 5 ++++- octavia/tests/unit/common/test_base_taskflow.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/octavia/common/base_taskflow.py b/octavia/common/base_taskflow.py index b519ae2c7c..3b4e76ecb5 100644 --- a/octavia/common/base_taskflow.py +++ b/octavia/common/base_taskflow.py @@ -165,7 +165,10 @@ class TaskFlowServiceController(object): 'redis_taskflow_driver'): conductor = RedisDynamicLoggingConductor( name, board, persistence=persistence, - engine=CONF.task_flow.engine) + engine=CONF.task_flow.engine, + engine_options={ + 'max_workers': CONF.task_flow.max_workers + }) board.claim = functools.partial( board.claim, expiry=CONF.task_flow.jobboard_expiration_time) diff --git a/octavia/tests/unit/common/test_base_taskflow.py b/octavia/tests/unit/common/test_base_taskflow.py index dc18bc14a0..794128769b 100644 --- a/octavia/tests/unit/common/test_base_taskflow.py +++ b/octavia/tests/unit/common/test_base_taskflow.py @@ -75,6 +75,7 @@ class TestTaskFlowServiceController(base.TestCase): def setUp(self): self.conf = oslo_fixture.Config(cfg.CONF) self.conf.config(group="task_flow", engine='parallel') + self.conf.config(group="task_flow", max_workers=MAX_WORKERS) self.driver_mock = mock.MagicMock() self.persistence_mock = mock.MagicMock() self.jobboard_mock = mock.MagicMock() @@ -140,7 +141,10 @@ class TestTaskFlowServiceController(base.TestCase): rediscond.assert_called_once_with( "test", self.jobboard_mock.__enter__(), persistence=self.persistence_mock.__enter__(), - engine='parallel') + engine='parallel', + engine_options={ + 'max_workers': MAX_WORKERS, + }) self.conf.config(group="task_flow", jobboard_backend_driver='zookeeper_taskflow_driver')