Provide the compilation object instead of just a part of it

The compilation result will be able to contain more than just
an execution graph in the near future so we should provide it
back instead of a subcomponent of the compilation result.

Breaking change: removes access to the execution graph property
and replaces it with a compilation property (that will contain
the execution graph and any other compilation related objects).

Change-Id: Ieba63f5ab3a59c38f4aa2a22d9caad412f8fa85d
This commit is contained in:
Joshua Harlow
2014-06-02 16:41:22 -07:00
parent c8a281aa36
commit 5a2dcfb624
3 changed files with 10 additions and 12 deletions

View File

@@ -71,15 +71,17 @@ class ActionEngine(base.EngineBase):
self._change_state(states.SUSPENDING) self._change_state(states.SUSPENDING)
@property @property
def execution_graph(self): def compilation(self):
"""The graph of nodes to be executed. """The compilation result.
NOTE(harlowja): Only accessible after compilation has completed. NOTE(harlowja): Only accessible after compilation has completed (None
will be returned when this property is accessed before compilation has
completed successfully).
""" """
g = None
if self._compiled: if self._compiled:
g = self._compilation.execution_graph return self._compilation
return g else:
return None
def run(self): def run(self):
with lock_utils.try_lock(self._lock) as was_locked: with lock_utils.try_lock(self._lock) as was_locked:

View File

@@ -31,10 +31,6 @@ class GraphAnalyzer(object):
self._graph = graph self._graph = graph
self._storage = storage self._storage = storage
@property
def execution_graph(self):
return self._graph
def get_next_nodes(self, node=None): def get_next_nodes(self, node=None):
if node is None: if node is None:
execute = self.browse_nodes_for_execute() execute = self.browse_nodes_for_execute()

View File

@@ -509,7 +509,7 @@ class EngineGraphFlowTest(utils.EngineTestBase):
engine = self._make_engine(flow) engine = self._make_engine(flow)
engine.compile() engine.compile()
graph = engine.execution_graph graph = engine.compilation.execution_graph
self.assertIsInstance(graph, gr.DiGraph) self.assertIsInstance(graph, gr.DiGraph)
def test_task_graph_property_for_one_task(self): def test_task_graph_property_for_one_task(self):
@@ -517,7 +517,7 @@ class EngineGraphFlowTest(utils.EngineTestBase):
engine = self._make_engine(flow) engine = self._make_engine(flow)
engine.compile() engine.compile()
graph = engine.execution_graph graph = engine.compilation.execution_graph
self.assertIsInstance(graph, gr.DiGraph) self.assertIsInstance(graph, gr.DiGraph)