Update execute/revert comments

The basetask revert/execute comments were updated to be more
clear and to remove the details about context (which no longer
is passed in) as well as to explain the kwargs passed into the
revert method and how and why they are provided.

Change-Id: Ie3abb1c73a526e35f37eb2636407dac983e7fcc4
This commit is contained in:
Joshua Harlow
2014-01-26 20:41:35 -08:00
parent e7ddf80cbc
commit e13e831592

View File

@@ -48,16 +48,29 @@ class BaseTask(atom.Atom):
def execute(self, *args, **kwargs): def execute(self, *args, **kwargs):
"""Activate a given task which will perform some operation and return. """Activate a given task which will perform some operation and return.
This method can be used to apply some given context and given set This method can be used to perform an action on a given set of input
of args and kwargs to accomplish some goal. Note that the result requirements (passed in via *args and **kwargs) to accomplish some type
that is returned needs to be serializable so that it can be passed of operation. This operation may provide some named outputs/results as
back into this task if reverting is triggered. a result of it executing for later reverting (or for other tasks to
depend on).
NOTE(harlowja): the result (if any) that is returned should be
persistable so that it can be passed back into this task if
reverting is triggered (especially in the case where reverting
happens in a different python process or on a remote machine) and so
that the result can be transmitted to other tasks (which may be local
or remote).
""" """
def revert(self, *args, **kwargs): def revert(self, *args, **kwargs):
"""Revert this task using the given context, result that the apply """Revert this task using the result that the execute function
provided as well as any information which may have caused said provided as well as any failure information which caused the
reversion. reversion to be triggered in the first place.
NOTE(harlowja): The **kwargs which are passed into the execute()
method will also be passed into this method. The **kwargs key 'result'
will contain the execute() functions result (if any) and the **kwargs
key 'flow_failures' will contain the failure information.
""" """
def update_progress(self, progress, **kwargs): def update_progress(self, progress, **kwargs):