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:25:50 UTC
incubator-ariatosca git commit: fix retying mechanism
Repository: incubator-ariatosca
Updated Branches:
refs/heads/ARIA-284-Cleanup-and-optimize-the-task-execution a66b74bf0 -> 92773e206
fix retying mechanism
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/92773e20
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/92773e20
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/92773e20
Branch: refs/heads/ARIA-284-Cleanup-and-optimize-the-task-execution
Commit: 92773e206c82a961ac127c71731de2cdcf6f7f2a
Parents: a66b74b
Author: max-orlov <ma...@gigaspaces.com>
Authored: Wed Jun 21 15:25:44 2017 +0300
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Wed Jun 21 15:25:44 2017 +0300
----------------------------------------------------------------------
aria/orchestrator/workflows/core/engine.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/92773e20/aria/orchestrator/workflows/core/engine.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/workflows/core/engine.py b/aria/orchestrator/workflows/core/engine.py
index 8999232..8f16203 100644
--- a/aria/orchestrator/workflows/core/engine.py
+++ b/aria/orchestrator/workflows/core/engine.py
@@ -53,8 +53,8 @@ class Engine(logger.LoggerMixin):
if cancel:
break
for task in task_tracker.ended_tasks:
- task_tracker.finished_(task)
self._handle_ended_tasks(task)
+ task_tracker.finished_(task)
for task in task_tracker.executable_tasks:
task_tracker.executing_(task)
self._handle_executable_task(ctx, task)
@@ -110,7 +110,7 @@ class Engine(logger.LoggerMixin):
raise exceptions.ExecutorException('Workflow failed')
-class _TasksTracker():
+class _TasksTracker(object):
def __init__(self, ctx):
self._ctx = ctx
self._tasks = ctx.execution.tasks
@@ -123,8 +123,10 @@ class _TasksTracker():
return len(self._executed_tasks) == len(self._tasks) and len(self._executing_tasks) == 0
def executing_(self, task):
- self._executable_tasks.remove(task)
- self._executing_tasks.append(task)
+ # Task executing could be retrying (thus removed and added earlier)
+ if task not in self._executing_tasks:
+ self._executable_tasks.remove(task)
+ self._executing_tasks.append(task)
def finished_(self, task):
self._executing_tasks.remove(task)
@@ -139,7 +141,7 @@ class _TasksTracker():
@property
def executable_tasks(self):
now = datetime.utcnow()
- for task in self._update_tasks(self._executable_tasks):
+ for task in self._update_tasks(self._executing_tasks + self._executable_tasks):
if all([task.is_waiting(),
task.due_at <= now,
all(dependency in self._executed_tasks for dependency in task.dependencies)