Repository: incubator-ariatosca Updated Branches: refs/heads/ARIA-299-Resuming-canceled-execution-with-frozen-task-fails 770f161a1 -> 1e2e793ba
reinstated timeout and removed task to pending Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/1e2e793b Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/1e2e793b Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/1e2e793b Branch: refs/heads/ARIA-299-Resuming-canceled-execution-with-frozen-task-fails Commit: 1e2e793ba5a073b9af6e026429ea7e96323beaf6 Parents: 770f161 Author: max-orlov <[email protected]> Authored: Sun Jul 9 11:48:45 2017 +0300 Committer: max-orlov <[email protected]> Committed: Sun Jul 9 11:48:45 2017 +0300 ---------------------------------------------------------------------- aria/orchestrator/workflows/core/events_handler.py | 6 +++--- aria/orchestrator/workflows/executor/thread.py | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1e2e793b/aria/orchestrator/workflows/core/events_handler.py ---------------------------------------------------------------------- diff --git a/aria/orchestrator/workflows/core/events_handler.py b/aria/orchestrator/workflows/core/events_handler.py index eb6f271..7e5eb81 100644 --- a/aria/orchestrator/workflows/core/events_handler.py +++ b/aria/orchestrator/workflows/core/events_handler.py @@ -115,9 +115,9 @@ def _workflow_cancelled(workflow_context, *args, **kwargs): _log_tried_to_cancel_execution_but_it_already_ended(workflow_context, execution.status) else: # Any non ended task would be put back to pending state - for task in execution.tasks: - if not task.has_ended(): - task.status = task.PENDING + # for task in execution.tasks: + # if not task.has_ended(): + # task.status = task.PENDING execution.status = execution.CANCELLED execution.ended_at = datetime.utcnow() http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/1e2e793b/aria/orchestrator/workflows/executor/thread.py ---------------------------------------------------------------------- diff --git a/aria/orchestrator/workflows/executor/thread.py b/aria/orchestrator/workflows/executor/thread.py index d9dcdf8..6cef2c0 100644 --- a/aria/orchestrator/workflows/executor/thread.py +++ b/aria/orchestrator/workflows/executor/thread.py @@ -36,9 +36,10 @@ class ThreadExecutor(BaseExecutor): Note: This executor is incapable of running plugin operations. """ - def __init__(self, pool_size=1, *args, **kwargs): + def __init__(self, pool_size=1, close_timeout=5, *args, **kwargs): super(ThreadExecutor, self).__init__(*args, **kwargs) self._stopped = False + self._close_timeout = close_timeout self._queue = Queue.Queue() self._pool = [] for i in range(pool_size): @@ -54,7 +55,10 @@ class ThreadExecutor(BaseExecutor): def close(self): self._stopped = True for thread in self._pool: - thread.join() + if self._close_timeout is None: + thread.join() + else: + thread.join(self._close_timeout) def _processor(self): while not self._stopped:
