Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A0DA2200CC0 for ; Sun, 9 Jul 2017 10:48:56 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9F4B116B9A2; Sun, 9 Jul 2017 08:48:56 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E55BD16B9A1 for ; Sun, 9 Jul 2017 10:48:55 +0200 (CEST) Received: (qmail 7485 invoked by uid 500); 9 Jul 2017 08:48:55 -0000 Mailing-List: contact commits-help@ariatosca.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ariatosca.incubator.apache.org Delivered-To: mailing list commits@ariatosca.incubator.apache.org Received: (qmail 7476 invoked by uid 99); 9 Jul 2017 08:48:55 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Jul 2017 08:48:55 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id C6ECA1A5F0E for ; Sun, 9 Jul 2017 08:48:53 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.221 X-Spam-Level: X-Spam-Status: No, score=-4.221 tagged_above=-999 required=6.31 tests=[HK_RANDOM_FROM=0.001, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id I_C8d6eqE9L4 for ; Sun, 9 Jul 2017 08:48:52 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 861565F2AB for ; Sun, 9 Jul 2017 08:48:51 +0000 (UTC) Received: (qmail 7468 invoked by uid 99); 9 Jul 2017 08:48:50 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Jul 2017 08:48:50 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0462DE0A98; Sun, 9 Jul 2017 08:48:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mxmrlv@apache.org To: commits@ariatosca.incubator.apache.org Message-Id: <68318d6973ef458588121f1c9cdcd322@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-ariatosca git commit: reinstated timeout and removed task to pending Date: Sun, 9 Jul 2017 08:48:49 +0000 (UTC) archived-at: Sun, 09 Jul 2017 08:48:56 -0000 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 Authored: Sun Jul 9 11:48:45 2017 +0300 Committer: max-orlov 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: