From 7477c243cab8dd36896155ac0a110987d75e4e3c Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Fri, 23 May 2014 20:01:14 -0700 Subject: [PATCH] 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 --- doc/source/notifications.rst | 11 ++++++----- taskflow/engines/base.py | 8 +++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/doc/source/notifications.rst b/doc/source/notifications.rst index f477e396..b533e961 100644 --- a/doc/source/notifications.rst +++ b/doc/source/notifications.rst @@ -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 ` +class that is attached +to :py:class:`engine ` +attributes ``task_notifier`` and ``notifier``. -TaskFlow also has a set of predefined :ref:`listeners `, and +Taskflow also comes with a set of predefined :ref:`listeners `, and provides means to write your own listeners, which can be more convenient than using raw callbacks. diff --git a/taskflow/engines/base.py b/taskflow/engines/base.py index eb8d76ee..9255a3da 100644 --- a/taskflow/engines/base.py +++ b/taskflow/engines/base.py @@ -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