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 3783F200CC5 for ; Tue, 11 Jul 2017 15:17:00 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 360B6165C9F; Tue, 11 Jul 2017 13:17:00 +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 5569E165CA4 for ; Tue, 11 Jul 2017 15:16:59 +0200 (CEST) Received: (qmail 97861 invoked by uid 500); 11 Jul 2017 13:16:58 -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 97833 invoked by uid 99); 11 Jul 2017 13:16:58 -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; Tue, 11 Jul 2017 13:16:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 94E27DFC26; Tue, 11 Jul 2017 13:16:57 +0000 (UTC) From: ran-z To: commits@ariatosca.apache.org Reply-To: commits@ariatosca.apache.org References: In-Reply-To: Subject: [GitHub] incubator-ariatosca pull request #176: ARIA-237 Support for resuming failed ... Content-Type: text/plain Message-Id: <20170711131657.94E27DFC26@git1-us-west.apache.org> Date: Tue, 11 Jul 2017 13:16:57 +0000 (UTC) archived-at: Tue, 11 Jul 2017 13:17:00 -0000 Github user ran-z commented on a diff in the pull request: https://github.com/apache/incubator-ariatosca/pull/176#discussion_r126684398 --- Diff: tests/orchestrator/test_workflow_runner.py --- @@ -474,10 +483,62 @@ def test_resume_failed_task(self, workflow_context, thread_executor): new_thread_executor.close() # Wait for it to finish and assert changes. + node = workflow_context.model.node.refresh(node) assert node.attributes['invocations'].value == task.max_attempts - 1 assert task.status == task.SUCCESS assert wf_runner.execution.status == wf_runner.execution.SUCCEEDED + def test_resume_failed_task_and_successful_task(self, workflow_context, thread_executor): + node = workflow_context.model.node.get_by_name(tests_mock.models.DEPENDENCY_NODE_NAME) + node.attributes['invocations'] = models.Attribute.wrap('invocations', 0) + self._create_interface(workflow_context, node, mock_failed_task) + + wf_runner = self._create_initial_workflow_runner( + workflow_context, + mock_parallel_tasks_workflow, + thread_executor, + inputs={'retry_interval': 1, 'max_attempts': 1, 'number_of_tasks': 2} + ) + wf_thread = Thread(target=wf_runner.execute) + wf_thread.setDaemon(True) + wf_thread.start() + + if custom_events['execution_failed'].wait(60) is False: + raise TimeoutError("Execution did not end") + + tasks = workflow_context.model.task.list(filters={'_stub_type': None}) + node = workflow_context.model.node.refresh(node) + assert node.attributes['invocations'].value == 2 + + # First task passes + assert any(task.status == task.FAILED for task in tasks) + # Second task fails + assert any(task.status == task.SUCCESS for task in tasks) + assert wf_runner.execution.status in wf_runner.execution.FAILED + + custom_events['is_resumed'].set() + new_thread_executor = thread.ThreadExecutor() + try: + new_wf_runner = WorkflowRunner( + service_id=wf_runner.service.id, + retry_failed=True, + inputs={}, + model_storage=workflow_context.model, + resource_storage=workflow_context.resource, + plugin_manager=None, + execution_id=wf_runner.execution.id, + executor=new_thread_executor) + + new_wf_runner.execute() + finally: + new_thread_executor.close() + + # Wait for it to finish and assert changes. + node = workflow_context.model.node.refresh(node) + assert node.attributes['invocations'].value == 3 --- End diff -- Add an assert for validating the retry_count is reset back to 0 when using `retry_failed` = `True` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---