ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxm...@apache.org
Subject incubator-ariatosca git commit: phase 3 fixes
Date Tue, 20 Jun 2017 14:03:08 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-278-Remove-core-tasks 2459a3e05 -> 43371e01f


phase 3 fixes


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

Branch: refs/heads/ARIA-278-Remove-core-tasks
Commit: 43371e01f1e8b80ff9b23fdd5ab7d233b4a1347f
Parents: 2459a3e
Author: max-orlov <maxim@gigaspaces.com>
Authored: Tue Jun 20 17:03:04 2017 +0300
Committer: max-orlov <maxim@gigaspaces.com>
Committed: Tue Jun 20 17:03:04 2017 +0300

----------------------------------------------------------------------
 aria/orchestrator/workflows/api/task.py                         | 4 ++--
 aria/orchestrator/workflows/core/task.py                        | 2 +-
 tests/end2end/testenv.py                                        | 3 ---
 tests/orchestrator/context/__init__.py                          | 2 +-
 tests/orchestrator/context/test_operation.py                    | 2 +-
 tests/orchestrator/context/test_serialize.py                    | 5 ++---
 tests/orchestrator/execution_plugin/test_local.py               | 2 +-
 tests/orchestrator/execution_plugin/test_ssh.py                 | 2 +-
 tests/orchestrator/test_workflow_runner.py                      | 4 ++--
 tests/orchestrator/workflows/core/test_engine.py                | 5 ++---
 tests/orchestrator/workflows/core/test_events.py                | 2 +-
 .../workflows/core/test_task_graph_into_execution_graph.py      | 3 ---
 .../workflows/executor/test_process_executor_extension.py       | 2 +-
 .../workflows/executor/test_process_executor_tracked_changes.py | 2 +-
 14 files changed, 16 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/43371e01/aria/orchestrator/workflows/api/task.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/api/task.py b/aria/orchestrator/workflows/api/task.py
index 0e80e8a..ce34005 100644
--- a/aria/orchestrator/workflows/api/task.py
+++ b/aria/orchestrator/workflows/api/task.py
@@ -140,9 +140,9 @@ class OperationTask(BaseTask):
         self.arguments = modeling_utils.merge_parameter_values(arguments,
                                                                operation.arguments,
                                                                model_cls=models.Argument)
-        if isinstance(self.actor, models.Node):
+        if getattr(self.actor, 'outbound_relationships', None) is not None:
             self._context_cls = context.operation.NodeOperationContext
-        elif isinstance(self.actor, models.Relationship):
+        elif getattr(self.actor, 'source_node', None) is not None:
             self._context_cls = context.operation.RelationshipOperationContext
         else:
             self._context_cls = context.operation.BaseOperationContext

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/43371e01/aria/orchestrator/workflows/core/task.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/core/task.py b/aria/orchestrator/workflows/core/task.py
index 84ce819..a9f8d18 100644
--- a/aria/orchestrator/workflows/core/task.py
+++ b/aria/orchestrator/workflows/core/task.py
@@ -77,7 +77,7 @@ def _construct_execution_tasks(execution,
                         _api_id=task.id,
                         _executor=stub_executor,
                         _stub_type=models.Task.STUB,
-                        )
+                       )
         else:
             raise RuntimeError('Undefined state')
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/43371e01/tests/end2end/testenv.py
----------------------------------------------------------------------
diff --git a/tests/end2end/testenv.py b/tests/end2end/testenv.py
index 87ca5bd..85714e5 100644
--- a/tests/end2end/testenv.py
+++ b/tests/end2end/testenv.py
@@ -60,9 +60,6 @@ class TestEnvironment(object):
 
     def execute_workflow(self, service_name, workflow_name, dry=False):
         self.cli.executions.start(workflow_name, service_name=service_name, dry=dry)
-        service = self.model_storage.service.get_by_name(service_name)
-        for active_execution in [e for e in service.executions if not e.has_ended()]:
-            self.model_storage.execution.refresh(active_execution)
 
     def verify_clean_storage(self):
         assert len(self.model_storage.service_template.list()) == 0

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/43371e01/tests/orchestrator/context/__init__.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/context/__init__.py b/tests/orchestrator/context/__init__.py
index b55755b..777c051 100644
--- a/tests/orchestrator/context/__init__.py
+++ b/tests/orchestrator/context/__init__.py
@@ -27,6 +27,6 @@ def execute(workflow_func, workflow_context, executor):
     graph = workflow_func(ctx=workflow_context)
 
     task.create_execution_tasks(workflow_context, graph, executor.__class__)
-    eng = engine.Engine(executor)
+    eng = engine.Engine(executors={executor.__class__: executor})
 
     eng.execute(workflow_context)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/43371e01/tests/orchestrator/context/test_operation.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/context/test_operation.py b/tests/orchestrator/context/test_operation.py
index f654fe5..9550d12 100644
--- a/tests/orchestrator/context/test_operation.py
+++ b/tests/orchestrator/context/test_operation.py
@@ -408,7 +408,7 @@ def _assert_loggins(ctx, arguments):
     assert len(executions) == 1
     execution = executions[0]
 
-    tasks = ctx.model.task.list(filters={'stub_type': None})
+    tasks = ctx.model.task.list(filters={'_stub_type': None})
     assert len(tasks) == 1
     task = tasks[0]
     assert len(task.logs) == 4

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/43371e01/tests/orchestrator/context/test_serialize.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/context/test_serialize.py b/tests/orchestrator/context/test_serialize.py
index 934b914..c9227e6 100644
--- a/tests/orchestrator/context/test_serialize.py
+++ b/tests/orchestrator/context/test_serialize.py
@@ -49,15 +49,14 @@ def test_serialize_operation_context(context, executor, tmpdir):
 
     graph = _mock_workflow(ctx=context)  # pylint: disable=no-value-for-parameter
     task.create_execution_tasks(context, graph, executor.__class__)
-    eng = engine.Engine(executor)
+    eng = engine.Engine({executor.__class__: executor})
     eng.execute(context)
 
 
 @workflow
 def _mock_workflow(ctx, graph):
     node = ctx.model.node.get_by_name(mock.models.DEPENDENCY_NODE_NAME)
-    task = api.task.OperationTask(node, interface_name='test', operation_name='op')
-    graph.add_tasks(task)
+    graph.add_tasks(api.task.OperationTask(node, interface_name='test', operation_name='op'))
     return graph
 
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/43371e01/tests/orchestrator/execution_plugin/test_local.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/execution_plugin/test_local.py b/tests/orchestrator/execution_plugin/test_local.py
index 3936931..361ddab 100644
--- a/tests/orchestrator/execution_plugin/test_local.py
+++ b/tests/orchestrator/execution_plugin/test_local.py
@@ -501,7 +501,7 @@ if __name__ == '__main__':
             return graph
         tasks_graph = mock_workflow(ctx=workflow_context)  # pylint: disable=no-value-for-parameter
         task.create_execution_tasks(workflow_context, tasks_graph, executor.__class__)
-        eng = engine.Engine(executor)
+        eng = engine.Engine({executor.__class__: executor})
         eng.execute(workflow_context)
         return workflow_context.model.node.get_by_name(
             mock.models.DEPENDENCY_NODE_NAME).attributes

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/43371e01/tests/orchestrator/execution_plugin/test_ssh.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/execution_plugin/test_ssh.py b/tests/orchestrator/execution_plugin/test_ssh.py
index 8936a98..1498cd1 100644
--- a/tests/orchestrator/execution_plugin/test_ssh.py
+++ b/tests/orchestrator/execution_plugin/test_ssh.py
@@ -255,7 +255,7 @@ class TestWithActualSSHServer(object):
             return graph
         tasks_graph = mock_workflow(ctx=self._workflow_context)  # pylint: disable=no-value-for-parameter
         task.create_execution_tasks(self._workflow_context, tasks_graph, self._executor.__class__)
-        eng = engine.Engine(self._executor)
+        eng = engine.Engine({self._executor.__class__: self._executor})
         eng.execute(self._workflow_context)
         return self._workflow_context.model.node.get_by_name(
             mock.models.DEPENDENCY_NODE_NAME).attributes

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/43371e01/tests/orchestrator/test_workflow_runner.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/test_workflow_runner.py b/tests/orchestrator/test_workflow_runner.py
index c2312b1..40f9035 100644
--- a/tests/orchestrator/test_workflow_runner.py
+++ b/tests/orchestrator/test_workflow_runner.py
@@ -99,7 +99,7 @@ def test_default_executor(request):
     with mock.patch('aria.orchestrator.workflow_runner.engine.Engine') as mock_engine_cls:
         _create_workflow_runner(request, mock_workflow)
         _, engine_kwargs = mock_engine_cls.call_args
-        assert isinstance(engine_kwargs.get('default_executor'), ProcessExecutor)
+        assert isinstance(engine_kwargs.get('executors').values()[0], ProcessExecutor)
 
 
 def test_custom_executor(request):
@@ -109,7 +109,7 @@ def test_custom_executor(request):
     with mock.patch('aria.orchestrator.workflow_runner.engine.Engine') as mock_engine_cls:
         _create_workflow_runner(request, mock_workflow, executor=custom_executor)
         _, engine_kwargs = mock_engine_cls.call_args
-        assert engine_kwargs.get('default_executor') == custom_executor
+        assert engine_kwargs.get('executors').values()[0] == custom_executor
 
 
 def test_task_configuration_parameters(request):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/43371e01/tests/orchestrator/workflows/core/test_engine.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/core/test_engine.py b/tests/orchestrator/workflows/core/test_engine.py
index 36aa63a..44ec1da 100644
--- a/tests/orchestrator/workflows/core/test_engine.py
+++ b/tests/orchestrator/workflows/core/test_engine.py
@@ -50,10 +50,9 @@ class BaseTest(object):
     @staticmethod
     def _engine(workflow_func, workflow_context, executor):
         graph = workflow_func(ctx=workflow_context)
-        execution = workflow_context.execution
-        task.create_execution_tasks(execution, graph, executor.__class__)
+        task.create_execution_tasks(workflow_context, graph, executor.__class__)
 
-        return engine.Engine(executors=executor)
+        return engine.Engine(executors={executor.__class__: executor})
 
     @staticmethod
     def _create_interface(ctx, func, arguments=None):

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/43371e01/tests/orchestrator/workflows/core/test_events.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/core/test_events.py b/tests/orchestrator/workflows/core/test_events.py
index befca1a..5f4868a 100644
--- a/tests/orchestrator/workflows/core/test_events.py
+++ b/tests/orchestrator/workflows/core/test_events.py
@@ -118,7 +118,7 @@ def run_operation_on_node(ctx, op_name, interface_name):
         single_operation_workflow(ctx, node=node, interface_name=interface_name, op_name=op_name),
         ThreadExecutor)
 
-    eng = engine.Engine(executors=ThreadExecutor())
+    eng = engine.Engine(executors={ThreadExecutor: ThreadExecutor()})
     eng.execute(ctx)
     return node
 

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/43371e01/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 1c25967..044d498 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
@@ -65,9 +65,6 @@ def test_task_graph_into_execution_graph(tmpdir):
     test_task_graph.add_dependency(inner_task_graph, simple_before_task)
     test_task_graph.add_dependency(simple_after_task, inner_task_graph)
 
-    # Direct check
-    execution = workflow_context.model.execution.list()[0]
-
     task.create_execution_tasks(workflow_context, test_task_graph, base.StubTaskExecutor)
 
     execution_tasks = topological_sort(workflow_context._graph)

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/43371e01/tests/orchestrator/workflows/executor/test_process_executor_extension.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor_extension.py b/tests/orchestrator/workflows/executor/test_process_executor_extension.py
index 9e4becd..8cd8123 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor_extension.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor_extension.py
@@ -58,7 +58,7 @@ def test_decorate_extension(context, executor):
         return graph
     graph = mock_workflow(ctx=context)  # pylint: disable=no-value-for-parameter
     task.create_execution_tasks(context, graph, executor.__class__)
-    eng = engine.Engine(executor)
+    eng = engine.Engine({executor.__class__: executor})
     eng.execute(context)
     out = get_node(context).attributes.get('out').value
     assert out['wrapper_arguments'] == arguments

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/43371e01/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
----------------------------------------------------------------------
diff --git a/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
b/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
index bfbb359..f0451d1 100644
--- a/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
+++ b/tests/orchestrator/workflows/executor/test_process_executor_tracked_changes.py
@@ -108,7 +108,7 @@ def _run_workflow(context, executor, op_func, arguments=None):
         return graph
     graph = mock_workflow(ctx=context)  # pylint: disable=no-value-for-parameter
     task.create_execution_tasks(context, graph, executor.__class__)
-    eng = engine.Engine(executor)
+    eng = engine.Engine({executor.__class__: executor})
     eng.execute(context)
     out = context.model.node.get_by_name(mock.models.DEPENDENCY_NODE_NAME).attributes.get('out')
     return out.value if out else None


Mime
View raw message