Merge "Leave the execution_graph as none until compiled"

This commit is contained in:
Jenkins
2014-03-31 12:31:05 +00:00
committed by Gerrit Code Review
2 changed files with 10 additions and 2 deletions

View File

@@ -77,8 +77,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):

View File

@@ -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)