Rename get_graph() -> execution_graph

Instead of having a generic get_graph()
it is nicer to have this function be named
closer to what it returns (the graph of tasks
to be executed) as well as make it a property
since it is more of a property of the engine.

Change-Id: I4bb458b1069d7e6877f1cc51d42bfc0d8c751951
This commit is contained in:
Joshua Harlow
2013-10-13 02:03:37 +00:00
parent faf2d155df
commit 756e09778d
2 changed files with 5 additions and 3 deletions

View File

@@ -74,7 +74,8 @@ class ActionEngine(base.EngineBase):
def suspend(self):
self._change_state(states.SUSPENDING)
def get_graph(self):
@property
def execution_graph(self):
self.compile()
return self._root.graph
@@ -131,6 +132,7 @@ class ActionEngine(base.EngineBase):
result=result)
self.task_notifier.notify(state, details)
@lock_utils.locked
def compile(self):
if self._root is not None:
return

View File

@@ -582,14 +582,14 @@ class EngineGraphFlowTest(EngineTestBase):
TestTask(name='task2'))
engine = self._make_engine(flow)
graph = engine.get_graph()
graph = engine.execution_graph
self.assertTrue(isinstance(graph, networkx.DiGraph))
def test_task_graph_property_for_one_task(self):
flow = TestTask(name='task1')
engine = self._make_engine(flow)
graph = engine.get_graph()
graph = engine.execution_graph
self.assertTrue(isinstance(graph, networkx.DiGraph))