Leave the execution_graph as none until compiled
Instead of forcing a compile when accessing the execution_graph property just leave it as none until compiling occurs. It seems awkward to have the side-effect of automatically compiling occur when a engine property is accessed. Change-Id: I2760c369bc5926c6293199cb7e500e98d6c3eeb9
This commit is contained in:
@@ -76,8 +76,14 @@ class ActionEngine(base.EngineBase):
|
||||
|
||||
@property
|
||||
def execution_graph(self):
|
||||
self.compile()
|
||||
return self._analyzer.execution_graph
|
||||
"""The graph of nodes to be executed.
|
||||
|
||||
NOTE(harlowja): Only accessible after compilation has completed.
|
||||
"""
|
||||
g = None
|
||||
if self._compiled and self._analyzer:
|
||||
g = self._analyzer.execution_graph
|
||||
return g
|
||||
|
||||
@lock_utils.locked
|
||||
def run(self):
|
||||
|
||||
@@ -464,6 +464,7 @@ class EngineGraphFlowTest(utils.EngineTestBase):
|
||||
utils.TaskNoRequiresNoReturns(name='task2'))
|
||||
|
||||
engine = self._make_engine(flow)
|
||||
engine.compile()
|
||||
graph = engine.execution_graph
|
||||
self.assertIsInstance(graph, networkx.DiGraph)
|
||||
|
||||
@@ -471,6 +472,7 @@ class EngineGraphFlowTest(utils.EngineTestBase):
|
||||
flow = utils.TaskNoRequiresNoReturns(name='task1')
|
||||
|
||||
engine = self._make_engine(flow)
|
||||
engine.compile()
|
||||
graph = engine.execution_graph
|
||||
self.assertIsInstance(graph, networkx.DiGraph)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user