Switch TaskFlow engine to parallel

The default TaskFlow engine is now set to 'parallel' instead of
'serial'. The parallel engine schedules tasks onto different threads to
allow for running non-dependent tasks simultaneously. This has the
benefit of accelerating the execution of some Octavia Amphora flows such
as provisioning of active-standby amphora loadbalancers.

Change-Id: I108b7f629d39c40b60ddf4a1878631f32e37b357
This commit is contained in:
Carlos Goncalves 2019-08-14 11:26:29 +02:00
parent 6e4da85064
commit 0978c776a2
5 changed files with 28 additions and 5 deletions

View File

@ -254,7 +254,12 @@
# user_data_config_drive = False # user_data_config_drive = False
[task_flow] [task_flow]
# engine = serial # TaskFlow engine options are:
# - serial: Runs all tasks on a single thread.
# - parallel: Schedules tasks onto different threads to allow
# for running non-dependent tasks simultaneously
#
# engine = parallel
# max_workers = 5 # max_workers = 5
# #
# This setting prevents the controller worker from reverting taskflow flows. # This setting prevents the controller worker from reverting taskflow flows.

View File

@ -429,8 +429,12 @@ controller_worker_opts = [
task_flow_opts = [ task_flow_opts = [
cfg.StrOpt('engine', cfg.StrOpt('engine',
default='serial', default='parallel',
help=_('TaskFlow engine to use')), choices=constants.SUPPORTED_TASKFLOW_ENGINE_TYPES,
help=_('TaskFlow engine to use. '
'serial - Runs all tasks on a single thread. '
'parallel - Schedules tasks onto different threads to '
'allow for running non-dependent tasks simultaneously')),
cfg.IntOpt('max_workers', cfg.IntOpt('max_workers',
default=5, default=5,
help=_('The maximum number of workers')), help=_('The maximum number of workers')),

View File

@ -280,6 +280,9 @@ HTTP_QUOTED_HEADER_VALUE_REGEX = (r'\A"[a-zA-Z0-9 \t'
DOMAIN_NAME_REGEX = ( DOMAIN_NAME_REGEX = (
r'^(?=.{1,253}\.?$)(?:(?!-|[^.]+_)[A-Za-z0-9-_]{1,63}(?<!-)(?:\.|$))+$') r'^(?=.{1,253}\.?$)(?:(?!-|[^.]+_)[A-Za-z0-9-_]{1,63}(?<!-)(?:\.|$))+$')
# TaskFlow
SUPPORTED_TASKFLOW_ENGINE_TYPES = ['serial', 'parallel']
# Task/Flow constants # Task/Flow constants
AMPHORA = 'amphora' AMPHORA = 'amphora'
FAILED_AMPHORA = 'failed_amphora' FAILED_AMPHORA = 'failed_amphora'

View File

@ -25,6 +25,7 @@ import octavia.tests.unit.base as base
MAX_WORKERS = 1 MAX_WORKERS = 1
ENGINE = 'parallel'
_engine_mock = mock.MagicMock() _engine_mock = mock.MagicMock()
@ -35,7 +36,7 @@ class TestBaseTaskFlowEngine(base.TestCase):
conf = oslo_fixture.Config(cfg.CONF) conf = oslo_fixture.Config(cfg.CONF)
conf.config(group="task_flow", max_workers=MAX_WORKERS) conf.config(group="task_flow", max_workers=MAX_WORKERS)
conf.config(group="task_flow", engine='TESTENGINE') conf.config(group="task_flow", engine=ENGINE)
conf.config(group="task_flow", disable_revert=True) conf.config(group="task_flow", disable_revert=True)
super(TestBaseTaskFlowEngine, self).setUp() super(TestBaseTaskFlowEngine, self).setUp()
@ -60,7 +61,7 @@ class TestBaseTaskFlowEngine(base.TestCase):
tf_engines.load.assert_called_once_with( tf_engines.load.assert_called_once_with(
'TEST', 'TEST',
engine='TESTENGINE', engine=ENGINE,
executor='TESTEXECUTOR', executor='TESTEXECUTOR',
never_resolve=True) never_resolve=True)

View File

@ -0,0 +1,10 @@
---
upgrade:
- |
The default TaskFlow engine is now set to 'parallel' instead of 'serial'.
The parallel engine schedules tasks onto different threads to allow for
running non-dependent tasks simultaneously. This has the benefit of
accelerating the execution of some Octavia Amphora flows such as
provisioning of active-standby amphora loadbalancers. Operators can revert
to previously default 'serial' engine type by setting the configuration
option [task_flow]/engine = serial