diff --git a/doc/source/dev/architecture.rst b/doc/source/dev/architecture.rst index 8a6d6f985e..46aebfa81d 100644 --- a/doc/source/dev/architecture.rst +++ b/doc/source/dev/architecture.rst @@ -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, diff --git a/ironic/drivers/base.py b/ironic/drivers/base.py index 9b7f56b618..e767d3789b 100644 --- a/ironic/drivers/base.py +++ b/ironic/drivers/base.py @@ -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__) @@ -1034,11 +1034,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 @@ -1055,6 +1052,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