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/15 13:42:05 UTC

incubator-ariatosca git commit: wip4

Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-278-Remove-core-tasks 21120aa64 -> 7c5b9ff73


wip4


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

Branch: refs/heads/ARIA-278-Remove-core-tasks
Commit: 7c5b9ff73fe438ce073e1ba481176d0b0a4d07f1
Parents: 21120aa
Author: max-orlov <ma...@gigaspaces.com>
Authored: Thu Jun 15 16:42:01 2017 +0300
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Thu Jun 15 16:42:01 2017 +0300

----------------------------------------------------------------------
 aria/modeling/orchestration.py                | 6 +-----
 aria/orchestrator/context/operation.py        | 3 ---
 aria/orchestrator/workflows/core/engine.py    | 8 ++------
 aria/orchestrator/workflows/events_logging.py | 8 ++++----
 aria/orchestrator/workflows/executor/base.py  | 6 ++----
 tests/end2end/testenv.py                      | 1 +
 6 files changed, 10 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7c5b9ff7/aria/modeling/orchestration.py
----------------------------------------------------------------------
diff --git a/aria/modeling/orchestration.py b/aria/modeling/orchestration.py
index 11a4684..007eefa 100644
--- a/aria/modeling/orchestration.py
+++ b/aria/modeling/orchestration.py
@@ -259,7 +259,6 @@ class TaskBase(mixins.ModelMixin):
     __private_fields__ = ['dependency_operation_task_fk', 'dependency_stub_task_fk', 'node_fk',
                           'relationship_fk', 'plugin_fk', 'execution_fk']
 
-
     START_WORKFLOW = 'start_workflow'
     END_WORKFLOW = 'end_workflow'
     START_SUBWROFKLOW = 'start_subworkflow'
@@ -408,10 +407,7 @@ class TaskBase(mixins.ModelMixin):
         return relationship.one_to_many_self(cls, 'dependency_fk')
 
     def has_ended(self):
-        if self.stub_type is not None:
-            return self.status == self.SUCCESS
-        else:
-            return self.status in (self.SUCCESS, self.FAILED)
+        return self.status in (self.SUCCESS, self.FAILED)
 
     def is_waiting(self):
         if self.stub_type:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7c5b9ff7/aria/orchestrator/context/operation.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/context/operation.py b/aria/orchestrator/context/operation.py
index 7591d70..6071c9b 100644
--- a/aria/orchestrator/context/operation.py
+++ b/aria/orchestrator/context/operation.py
@@ -59,9 +59,6 @@ class BaseOperationContext(common.BaseContext):
             self._thread_local.task = self.model.task.get(self._task_id)
         return self._thread_local.task
 
-    def update_task(self):
-        self.model.task.update(self.task)
-
     @property
     def plugin_workdir(self):
         """

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7c5b9ff7/aria/orchestrator/workflows/core/engine.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/core/engine.py b/aria/orchestrator/workflows/core/engine.py
index 9ac7215..db5cc8e 100644
--- a/aria/orchestrator/workflows/core/engine.py
+++ b/aria/orchestrator/workflows/core/engine.py
@@ -73,7 +73,6 @@ class Engine(logger.LoggerMixin):
         will be modified to 'cancelled' directly.
         """
         events.on_cancelling_workflow_signal.send(ctx)
-        ctx.execution = ctx.execution
 
     @staticmethod
     def _is_cancel(ctx):
@@ -95,8 +94,7 @@ class Engine(logger.LoggerMixin):
 
     @staticmethod
     def _task_has_dependencies(ctx, task):
-        return task.dependencies and \
-               all(d in ctx.graph for d in task.dependencies)
+        return len(ctx.graph.pred.get(task, [])) > 0
 
     @staticmethod
     def _all_tasks_consumed(ctx):
@@ -105,9 +103,7 @@ class Engine(logger.LoggerMixin):
     @staticmethod
     def _tasks_iter(ctx):
         for task in ctx.execution.tasks:
-            if not task.has_ended():
-                task = ctx.model.task.refresh(task)
-            yield task
+            yield ctx.model.task.refresh(task)
 
     def _handle_executable_task(self, ctx, task):
         if task._executor not in self._executors:

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7c5b9ff7/aria/orchestrator/workflows/events_logging.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/events_logging.py b/aria/orchestrator/workflows/events_logging.py
index e45367f..543e190 100644
--- a/aria/orchestrator/workflows/events_logging.py
+++ b/aria/orchestrator/workflows/events_logging.py
@@ -81,8 +81,8 @@ def _failure_workflow_handler(context, **kwargs):
 @events.on_success_workflow_signal.connect
 def _success_workflow_handler(context, **kwargs):
     with context.track_execution:
-        context.logger.info("'{ctx.workflow_name}' workflow execution succeeded".format(
-            ctx=context)
+        context.logger.info(
+            "'{ctx.workflow_name}' workflow execution succeeded".format(ctx=context)
         )
 
 
@@ -95,6 +95,6 @@ def _cancel_workflow_handler(context, **kwargs):
 @events.on_cancelling_workflow_signal.connect
 def _cancelling_workflow_handler(context, **kwargs):
     with context.track_execution:
-        context.logger.info("Cancelling '{ctx.workflow_name}' workflow execution".format(
-            ctx=context)
+        context.logger.info(
+            "Cancelling '{ctx.workflow_name}' workflow execution".format(ctx=context)
         )

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7c5b9ff7/aria/orchestrator/workflows/executor/base.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/executor/base.py b/aria/orchestrator/workflows/executor/base.py
index a2c9c62..ced80d6 100644
--- a/aria/orchestrator/workflows/executor/base.py
+++ b/aria/orchestrator/workflows/executor/base.py
@@ -55,13 +55,11 @@ class BaseExecutor(logger.LoggerMixin):
 
     @staticmethod
     def _task_failed(ctx, exception, traceback=None):
-        with ctx.track_task:
-            events.on_failure_task_signal.send(ctx, exception=exception, traceback=traceback)
+        events.on_failure_task_signal.send(ctx, exception=exception, traceback=traceback)
 
     @staticmethod
     def _task_succeeded(ctx):
-        with ctx.track_task:
-            events.on_success_task_signal.send(ctx)
+        events.on_success_task_signal.send(ctx)
 
 
 class StubTaskExecutor(BaseExecutor):                                                               # pylint: disable=abstract-method

http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/7c5b9ff7/tests/end2end/testenv.py
----------------------------------------------------------------------
diff --git a/tests/end2end/testenv.py b/tests/end2end/testenv.py
index 85714e5..9da747c 100644
--- a/tests/end2end/testenv.py
+++ b/tests/end2end/testenv.py
@@ -60,6 +60,7 @@ 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)
+        self.model_storage.execution.refresh(self.model_storage.execution.list()[0])
 
     def verify_clean_storage(self):
         assert len(self.model_storage.service_template.list()) == 0