ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ran-z <...@git.apache.org>
Subject [GitHub] incubator-ariatosca pull request #176: ARIA-237 Support for resuming failed ...
Date Tue, 11 Jul 2017 13:16:57 GMT
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.
---

Mime
View raw message