You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by mx...@apache.org on 2017/06/21 12:00:44 UTC

incubator-ariatosca git commit: removed _graph from workflow context entirely

Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-284-Cleanup-and-optimize-the-task-execution 5cb4f86a6 -> a66b74bf0


removed _graph from workflow context entirely


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/a66b74bf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/a66b74bf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/a66b74bf

Branch: refs/heads/ARIA-284-Cleanup-and-optimize-the-task-execution
Commit: a66b74bf06bb3245c69a15a1f601508f697c60ca
Parents: 5cb4f86
Author: max-orlov <ma...@gigaspaces.com>
Authored: Wed Jun 21 15:00:40 2017 +0300
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Wed Jun 21 15:00:40 2017 +0300

----------------------------------------------------------------------
 aria/orchestrator/context/workflow.py                  | 12 ------------
 .../core/test_task_graph_into_execution_graph.py       | 13 +++++++++++--
 2 files changed, 11 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a66b74bf/aria/orchestrator/context/workflow.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/context/workflow.py b/aria/orchestrator/context/workflow.py
index aa5a786..2da3d4c 100644
--- a/aria/orchestrator/context/workflow.py
+++ b/aria/orchestrator/context/workflow.py
@@ -96,18 +96,6 @@ class WorkflowContext(BaseContext):
         )
 
     @property
-    def _graph(self):
-        if self._execution_graph is None:
-            graph = DiGraph()
-            for task in self.execution.tasks:
-                for dependency in task.dependencies:
-                    graph.add_edge(dependency, task)
-
-            self._execution_graph = graph
-
-        return self._execution_graph
-
-    @property
     @contextmanager
     def persist_changes(self):
         yield

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a66b74bf/tests/orchestrator/workflows/core/test_task_graph_into_execution_graph.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/core/test_task_graph_into_execution_graph.py b/tests/orchestrator/workflows/core/test_task_graph_into_execution_graph.py
index ef20374..3d47d54 100644
--- a/tests/orchestrator/workflows/core/test_task_graph_into_execution_graph.py
+++ b/tests/orchestrator/workflows/core/test_task_graph_into_execution_graph.py
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from networkx import topological_sort
+from networkx import topological_sort, DiGraph
 
 from aria.modeling import models
 from aria.orchestrator import context
@@ -68,7 +68,7 @@ def test_task_graph_into_execution_graph(tmpdir):
     graph_compiler = compile.GraphCompiler(workflow_context, base.StubTaskExecutor)
     graph_compiler.compile(test_task_graph)
 
-    execution_tasks = topological_sort(workflow_context._graph)
+    execution_tasks = topological_sort(_graph(workflow_context.execution.tasks))
 
     assert len(execution_tasks) == 7
 
@@ -106,3 +106,12 @@ def _assert_execution_is_api_task(execution_task, api_task):
 
 def _get_task_by_name(task_name, graph):
     return graph.node[task_name]['task']
+
+
+def _graph(tasks):
+    graph = DiGraph()
+    for task in tasks:
+        for dependency in task.dependencies:
+            graph.add_edge(dependency, task)
+
+    return graph