diff options
author | Dmitry Tantsur <dtantsur@redhat.com> | 2016-01-07 12:12:59 +0100 |
---|---|---|
committer | Dmitry Tantsur <dtantsur@redhat.com> | 2016-02-24 15:44:05 +0100 |
commit | 3429e3824c060071e59a117c19c95659c78e4c8b (patch) | |
tree | c9d19c0029ac9b0c9012943140898ae262df17ad /doc | |
parent | a70b5365d34746d0e5f5d6f932829625d73c17cf (diff) | |
download | ironic-3429e3824c060071e59a117c19c95659c78e4c8b.tar.gz |
Switch to Futurist library for asynchronous execution and periodic tasks
This change switches the conductor to using Futurist library executor and
periodic tasks worker instead of oslo.service periodic tasks. This allows
running periodic tasks in parallel and relying on more standard interfaces
(futures, executors) when dealing with asynchronous execution.
A green thread executor is used instead of using an eventlet green pool
directly. The maximum number of workers is taken from the existing
workers_pool_size configuration option, and no tasks are allowed
to be enqueued to mimic the previous behaviour (might be lifted later).
The periodic tasks worker is using the same executor, and its main loop thread
is also running on it. For this reason minimum value for workers_pool_size
is now 3: periodic task main loop, keep alive thread and at least one thread for
other tasks. A special decorator for driver-periodic tasks is now deprecated,
as the generic decorator can be used there as well.
Closes-Bug: #1526277
Change-Id: I57bf7cebfb6db805b6c521bacfef2993b16ce1ee
Diffstat (limited to 'doc')
-rw-r--r-- | doc/source/dev/architecture.rst | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/doc/source/dev/architecture.rst b/doc/source/dev/architecture.rst index e055c2479..26dda4dfc 100644 --- a/doc/source/dev/architecture.rst +++ b/doc/source/dev/architecture.rst @@ -77,12 +77,14 @@ Driver-Specific Periodic Tasks Drivers may run their own periodic tasks, i.e. actions run repeatedly after a certain amount of time. Such task is created by decorating a method on the -driver itself or on any interface with driver_periodic_task_ decorator, e.g. +driver itself or on any interface with periodic_ decorator, e.g. :: + from futurist import periodics + class FakePower(base.PowerInterface): - @base.driver_periodic_task(spacing=42) + @periodics.periodic(spacing=42) def task(self, manager, context): pass # do something @@ -90,7 +92,7 @@ driver itself or on any interface with driver_periodic_task_ decorator, e.g. def __init__(self): self.power = FakePower() - @base.driver_periodic_task(spacing=42) + @periodics.periodic(spacing=42) def task2(self, manager, context): pass # do something @@ -98,21 +100,6 @@ driver itself or on any interface with driver_periodic_task_ decorator, e.g. Here the ``spacing`` argument is a period in seconds for a given periodic task. For example 'spacing=5' means every 5 seconds. -.. 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 running. - -.. note:: - By default periodic task names are derived from method names, - so they should be unique within a Python module. - Use ``name`` argument to driver_periodic_task_ to override - automatically generated name. - Message Routing =============== @@ -137,4 +124,4 @@ driver actions such as take-over or clean-up. .. _DB API: ../api/ironic.db.api.html .. _diskimage-builder: https://github.com/openstack/diskimage-builder .. _consistent hashing algorithm: ../api/ironic.common.hash_ring.html -.. _driver_periodic_task: ../api/ironic.drivers.base.html#ironic.drivers.base.driver_periodic_task +.. _periodic: http://docs.openstack.org/developer/futurist/api.html#futurist.periodics.periodic |