Rework the overview of the notification mechanism

Clean up the introduction where the notification mechanism
is defined so that it becomes more clear what its usage is
and what the attributes of an engine are that provide these
capabilities.

Change-Id: I4eeb9029b17d562111371c6f5155570b7a31859c
This commit is contained in:
Joshua Harlow
2014-05-23 20:01:14 -07:00
committed by Thomas Goirand
parent d9a0e4bc51
commit 56134a0ba5
2 changed files with 13 additions and 6 deletions

View File

@@ -16,12 +16,13 @@ Engines provide a way to receive notification on task and flow state
transitions, which is useful for monitoring, logging, metrics, debugging
and plenty of other tasks.
To receive these notifications you should register a callback in
:py:class:`~taskflow.utils.misc.Notifier` provided by engine.
Each engine provides two of them: one notifies about flow state changes,
and another notifies about changes of tasks.
To receive these notifications you should register a callback with
an instance of the the :py:class:`notifier <taskflow.utils.misc.Notifier>`
class that is attached
to :py:class:`engine <taskflow.engines.base.EngineBase>`
attributes ``task_notifier`` and ``notifier``.
TaskFlow also has a set of predefined :ref:`listeners <listeners>`, and
Taskflow also comes with a set of predefined :ref:`listeners <listeners>`, and
provides means to write your own listeners, which can be more convenient than
using raw callbacks.

View File

@@ -24,7 +24,13 @@ from taskflow.utils import misc
@six.add_metaclass(abc.ABCMeta)
class EngineBase(object):
"""Base for all engines implementations."""
"""Base for all engines implementations.
:ivar notifier: A notification object that will dispatch events that
occur related to the flow the engine contains.
:ivar task_notifier: A notification object that will dispatch events that
occur related to the tasks the engine contains.
"""
def __init__(self, flow, flow_detail, backend, conf):
self._flow = flow