From 59ae11658a138338ae97ab9b3ee4e24f5aee7f28 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Fri, 28 Mar 2014 16:56:51 -0700 Subject: [PATCH] Raise error if atom asked to schedule with unknown intention Instead of returning none from the schedule task/retry method if a unknown atom intention is declared (this will cause later failures) raise a execution failure when this happens to denote that this is a problematic & exceptional case. Change-Id: Id0e3211389e22459c5381f4a19d80d8d0baf1e25 --- taskflow/engines/action_engine/graph_action.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/taskflow/engines/action_engine/graph_action.py b/taskflow/engines/action_engine/graph_action.py index a1def849..ae7f9019 100644 --- a/taskflow/engines/action_engine/graph_action.py +++ b/taskflow/engines/action_engine/graph_action.py @@ -15,6 +15,7 @@ # under the License. from taskflow.engines.action_engine import executor as ex +from taskflow import exceptions as excp from taskflow import retry as r from taskflow import states as st from taskflow import task @@ -105,6 +106,9 @@ class FutureGraphAction(object): return self._task_action.schedule_execution(task) elif intention == st.REVERT: return self._task_action.schedule_reversion(task) + else: + raise excp.ExecutionFailure("Unknown how to schedule task with" + " intention: %s" % intention) def _complete_task(self, task, event, result): """Completes the given task, process task failure.""" @@ -126,6 +130,9 @@ class FutureGraphAction(object): self._retry_action.change_state(retry, st.RETRYING) self._retry_subflow(retry) return self._retry_action.execute(retry) + else: + raise excp.ExecutionFailure("Unknown how to schedule retry with" + " intention: %s" % intention) def _process_atom_failure(self, atom, failure): """On atom failure find its retry controller, ask for the action to