From 109b5984b1c62369e17aa6b007321958cf70dc57 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Sun, 28 Jun 2015 20:54:31 -0700 Subject: [PATCH] Just make the compiler object at __init__ time There really isn't any benefit in delaying the local attributes creation until its first used so just upfront create the compiler object. Change-Id: I48c4342a6669077dd35f9cb8f25b5313d6814c8e --- taskflow/engines/action_engine/engine.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/taskflow/engines/action_engine/engine.py b/taskflow/engines/action_engine/engine.py index 142f181c..9c03ca90 100644 --- a/taskflow/engines/action_engine/engine.py +++ b/taskflow/engines/action_engine/engine.py @@ -64,7 +64,6 @@ class ActionEngine(base.Engine): valid states in the states module to learn more about what other states the tasks and flow being ran can go through. """ - _compiler_factory = compiler.PatternCompiler NO_RERAISING_STATES = frozenset([states.SUSPENDED, states.SUCCESS]) """ @@ -78,6 +77,7 @@ class ActionEngine(base.Engine): self._runtime = None self._compiled = False self._compilation = None + self._compiler = compiler.PatternCompiler(flow) self._lock = threading.RLock() self._state_lock = threading.RLock() self._storage_ensured = False @@ -282,10 +282,6 @@ class ActionEngine(base.Engine): self._runtime.reset_all() self._change_state(states.PENDING) - @misc.cachedproperty - def _compiler(self): - return self._compiler_factory(self._flow) - @fasteners.locked def compile(self): if self._compiled: