Conductor periodics.
Bases: Exception
A signal to stop the current iteration of a periodic task.
A decorator to define a periodic task to act on nodes.
Defines a periodic task that fetches the list of nodes mapped to the current conductor which satisfy the provided filters.
The decorated function must be a method on either the conductor manager or a hardware interface. The signature is:
for conductor manager: (self, task, context)
for hardware interfaces: (self, task, manager, context)
.
When the periodic is running on a hardware interface, only tasks using this interface are considered.
NodeNotFound
and NodeLocked
exceptions are ignored. Raise Stop
to abort the current iteration of the task and reschedule it.
purpose – a human-readable description of the activity, e.g. “verifying that the cat is purring”.
spacing – how often (in seconds) to run the periodic task.
enabled – whether the task is enabled; defaults to spacing > 0
.
filters – database-level filters for the nodes.
predicate – a callable to run on the fetched nodes before creating
a task for them. The only parameter will be a named tuple with fields
uuid
, driver
, conductor_group
plus everything from
predicate_extra_fields
. If the callable accepts a 2nd parameter,
it will be the conductor manager instance.
predicate_extra_fields – extra fields to fetch on the initial
request and pass into the predicate
. Must not contain uuid
,
driver
and conductor_group
since they are always included.
limit – how many nodes to process before stopping the current
iteration. If predicate
returns False
, the node is not counted.
If the decorated function returns False
, the node is not counted
either. Can be a callable, in which case it will be called on each
iteration to determine the limit.
shared_task – if True
, the task will have a shared lock. It is
recommended to start with a shared lock and upgrade it only if needed.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.