summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-02-15 05:16:13 +0000
committerGerrit Code Review <review@openstack.org>2015-02-15 05:16:13 +0000
commit4d3b84f9606ea712c980466f4a425b546f71337c (patch)
tree69d5deb3ddd22a4704f2ca3a6e6b72a163fd89fc
parent345afc037bf6b9f1eb23e54b598f2611eb3f390b (diff)
parent101a47fe92389982b0fc5ff7d4f46880fbe75bff (diff)
downloadtaskflow-4d3b84f9606ea712c980466f4a425b546f71337c.tar.gz
Merge "Make the atom class an abstract class"
-rw-r--r--taskflow/atom.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/taskflow/atom.py b/taskflow/atom.py
index 3ece83f..1c5e61e 100644
--- a/taskflow/atom.py
+++ b/taskflow/atom.py
@@ -15,6 +15,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import abc
+
from oslo_utils import reflection
import six
@@ -128,6 +130,7 @@ def _build_arg_mapping(atom_name, reqs, rebind_args, function, do_infer,
return required, optional
+@six.add_metaclass(abc.ABCMeta)
class Atom(object):
"""An abstract flow atom that causes a flow to progress (in some manner).
@@ -205,6 +208,14 @@ class Atom(object):
"by this atom"
% dict(item=self.name, oo=sorted(out_of_order)))
+ @abc.abstractmethod
+ def execute(self, *args, **kwargs):
+ """Executes this atom."""
+
+ @abc.abstractmethod
+ def revert(self, *args, **kwargs):
+ """Reverts this atom (undoing any :meth:`execute` side-effects)."""
+
@property
def name(self):
"""A non-unique name for this atom (human readable)."""