From 24a11aa5235782d4c9aab91e977d6df73d011bea Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Mon, 11 May 2015 15:06:25 -0700 Subject: [PATCH] Expose action engine no reraising states constants Change-Id: I65746fc7bc27f0b03e416eb6584df18bbc4a3053 --- taskflow/engines/action_engine/engine.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/taskflow/engines/action_engine/engine.py b/taskflow/engines/action_engine/engine.py index bed43e8e..12f5feac 100644 --- a/taskflow/engines/action_engine/engine.py +++ b/taskflow/engines/action_engine/engine.py @@ -66,6 +66,13 @@ class ActionEngine(base.Engine): """ _compiler_factory = compiler.PatternCompiler + NO_RERAISING_STATES = frozenset([states.SUSPENDED, states.SUCCESS]) + """ + States that if the engine stops in will **not** cause any potential + failures to be reraised. States **not** in this list will cause any + failure/s that were captured (if any) to get reraised. + """ + def __init__(self, flow, flow_detail, backend, options): super(ActionEngine, self).__init__(flow, flow_detail, backend, options) self._runtime = None @@ -178,7 +185,7 @@ class ActionEngine(base.Engine): ignorable_states = getattr(runner, 'ignorable_states', []) if last_state and last_state not in ignorable_states: self._change_state(last_state) - if last_state not in [states.SUSPENDED, states.SUCCESS]: + if last_state not in self.NO_RERAISING_STATES: failures = self.storage.get_failures() failure.Failure.reraise_if_any(failures.values())