summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-06-01 01:41:53 +0000
committerGerrit Code Review <review@openstack.org>2016-06-01 01:41:53 +0000
commitf79d09597efe2ee9603231bbc9b6b4556507daac (patch)
treea471113b6f1248c3d53c8f17024148034a7b14bc
parent54f81126eae878ada85b905578ab14a6fd3d5a37 (diff)
parent8ab0ba9ea8037379dd59a5e972605ac7c6f89e67 (diff)
downloadtaskflow-f79d09597efe2ee9603231bbc9b6b4556507daac.tar.gz
Merge "Split revert/execute missing args messages"
-rw-r--r--taskflow/engines/action_engine/engine.py21
-rw-r--r--taskflow/exceptions.py6
2 files changed, 17 insertions, 10 deletions
diff --git a/taskflow/engines/action_engine/engine.py b/taskflow/engines/action_engine/engine.py
index aea4b1f..67c3ead 100644
--- a/taskflow/engines/action_engine/engine.py
+++ b/taskflow/engines/action_engine/engine.py
@@ -408,15 +408,18 @@ class ActionEngine(base.Engine):
revert_missing = self.storage.fetch_unsatisfied_args(
atom.name, atom.revert_rebind,
optional_args=atom.revert_optional)
- atom_missing = exec_missing.union(revert_missing)
- if atom_missing:
- cause = exc.MissingDependencies(atom,
- sorted(atom_missing),
- cause=last_cause)
- last_cause = cause
- last_node = atom
- missing_nodes += 1
- missing.update(atom_missing)
+ atom_missing = (('execute', exec_missing),
+ ('revert', revert_missing))
+ for method, method_missing in atom_missing:
+ if method_missing:
+ cause = exc.MissingDependencies(atom,
+ sorted(method_missing),
+ cause=last_cause,
+ method=method)
+ last_cause = cause
+ last_node = atom
+ missing_nodes += 1
+ missing.update(method_missing)
if missing:
# For when a task is provided (instead of a flow) and that
# task is the only item in the graph and its missing deps, avoid
diff --git a/taskflow/exceptions.py b/taskflow/exceptions.py
index beb66e9..c21f7fb 100644
--- a/taskflow/exceptions.py
+++ b/taskflow/exceptions.py
@@ -187,8 +187,12 @@ class MissingDependencies(DependencyFailure):
MESSAGE_TPL = ("'%(who)s' requires %(requirements)s but no other entity"
" produces said requirements")
- def __init__(self, who, requirements, cause=None):
+ METHOD_TPL = "'%(method)s' method on "
+
+ def __init__(self, who, requirements, cause=None, method=None):
message = self.MESSAGE_TPL % {'who': who, 'requirements': requirements}
+ if method:
+ message = (self.METHOD_TPL % {'method': method}) + message
super(MissingDependencies, self).__init__(message, cause=cause)
self.missing_requirements = requirements