Add deprecation warning to periodic tasks with parallel=False
This setting never made much sense, and with move to Futurist it is likely to become noop. Change-Id: Id6341e2cefcd74e0ebfe5a0a8fb32432159743fa
This commit is contained in:
parent
cd93da0437
commit
55e655a01e
@ -93,20 +93,18 @@ driver itself or on any interface with driver_periodic_task_ decorator, e.g.
|
||||
def task2(self, manager, context):
|
||||
pass # do something
|
||||
|
||||
@base.driver_periodic_task(parallel=False)
|
||||
def blocking_task(self, manager, context):
|
||||
pass # do something fast, this blocks other tasks from starting!
|
||||
|
||||
|
||||
Here the ``spacing`` argument is a period in seconds for a given periodic task.
|
||||
For example 'spacing=5' means every 5 seconds.
|
||||
|
||||
The ``parallel`` argument may be passed to driver_periodic_task_ and defaults
|
||||
to True. If False, this task will be run in the periodic task loop, rather
|
||||
than a separate greenthread. This should be used with caution, as it will
|
||||
cause all other periodic tasks to be blocked from starting while the
|
||||
non-parallel task is running. Long running tasks, especially any tasks that
|
||||
make a remote call (to a BMC, HTTP, etc.) **must** be parallelized.
|
||||
.. note::
|
||||
The ``parallel`` argument may be passed to driver_periodic_task_.
|
||||
If it's set to False, this task will be run in the periodic task loop,
|
||||
rather than a separate greenthread.
|
||||
|
||||
This is deprecated as of Liberty release, and the parallel argument will be
|
||||
ignored starting in the Mitaka cycle, as such task would prevent all other
|
||||
periodic tasks from starting while it is is running.
|
||||
|
||||
.. note::
|
||||
By default periodic task names are derived from method names,
|
||||
|
@ -32,7 +32,7 @@ from oslo_utils import excutils
|
||||
import six
|
||||
|
||||
from ironic.common import exception
|
||||
from ironic.common.i18n import _LE
|
||||
from ironic.common.i18n import _LE, _LW
|
||||
from ironic.common import raid
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -1021,11 +1021,8 @@ def driver_periodic_task(parallel=True, **other):
|
||||
|
||||
:param parallel: If True (default), this task is run in a separate thread.
|
||||
If False, this task will be run in the conductor's periodic task
|
||||
loop, rather than a separate greenthread. False should be used with
|
||||
caution, as it will cause all other periodic tasks to be blocked
|
||||
from starting while the non-parallel task is running. Long running
|
||||
tasks, especially any tasks that make a remote call (to a BMC,
|
||||
HTTP, etc.) must be parallelized.
|
||||
loop, rather than a separate greenthread. This parameter is
|
||||
deprecated and will be ignored starting with Mitaka cycle.
|
||||
:param other: arguments to pass to @periodic_task.periodic_task
|
||||
"""
|
||||
# TODO(dtantsur): drop all this magic once
|
||||
@ -1042,6 +1039,10 @@ def driver_periodic_task(parallel=True, **other):
|
||||
|
||||
eventlet.greenthread.spawn_n(_internal)
|
||||
else:
|
||||
LOG.warn(_LW(
|
||||
'Using periodic tasks with parallel=False is deprecated, '
|
||||
'"parallel" argument will be ignored starting with '
|
||||
'the Mitaka release'))
|
||||
func(*args, **kwargs)
|
||||
|
||||
# NOTE(dtantsur): name should be unique
|
||||
|
Loading…
x
Reference in New Issue
Block a user