/** * Retries the last failed task. * @param workflowId WorkflowId of the workflow. */ @Service public void retryWorkflow(String workflowId) { workflowExecutor.retry(workflowId); }
/** * Retry the last failed task for each workflow from the list. * @param workflowIds - list of workflow Ids to perform retry operation on * @return bulk response object containing a list of succeeded workflows and a list of failed ones with errors */ @Service public BulkResponse retry(List<String> workflowIds) { BulkResponse bulkResponse = new BulkResponse(); for (String workflowId : workflowIds) { workflowExecutor.retry(workflowId); try { workflowExecutor.retry(workflowId); bulkResponse.appendSuccessResponse(workflowId); } catch (Exception e) { LOGGER.error("bulk retry exception, workflowId {}, message: {} ",workflowId, e.getMessage(), e); bulkResponse.appendFailedResponse(workflowId, e.getMessage()); } } return bulkResponse; }
@Test public void testRetryWorkflow() { workflowService.retryWorkflow("w123"); verify(mockWorkflowExecutor, times(1)).retry(anyString()); }
@Test(expected = ApplicationException.class) public void testRetryWorkflowNoTasks() { Workflow workflow = new Workflow(); workflow.setWorkflowId("ApplicationException"); workflow.setStatus(Workflow.WorkflowStatus.FAILED); //noinspection unchecked workflow.setTasks(new ArrayList()); when(executionDAOFacade.getWorkflowById(anyString(), anyBoolean())).thenReturn(workflow); workflowExecutor.retry(workflow.getWorkflowId()); }
@Test(expected = ApplicationException.class) public void testRetryNonTerminalWorkflow() { Workflow workflow = new Workflow(); workflow.setWorkflowId("testRetryNonTerminalWorkflow"); workflow.setStatus(Workflow.WorkflowStatus.COMPLETED); when(executionDAOFacade.getWorkflowById(anyString(), anyBoolean())).thenReturn(workflow); workflowExecutor.retry(workflow.getWorkflowId()); }
when(metadataDAO.get(anyString(), anyInt())).thenReturn(Optional.of(workflowDef)); workflowExecutor.retry(workflow.getWorkflowId());
@Test public void testRetryWithForkJoin() throws Exception { String workflowId = this.runAFailedForkJoinWF(); workflowExecutor.retry(workflowId);
workflowExecutor.retry(subWorkflowId); task = workflowExecutionService.poll("junit_task_1", "test"); task.setStatus(COMPLETED);
workflowExecutor.retry(workflowId);
/** * Retries the last failed task. * @param workflowId WorkflowId of the workflow. */ @Service public void retryWorkflow(String workflowId) { workflowExecutor.retry(workflowId); }
/** * Retry the last failed task for each workflow from the list. * @param workflowIds - list of workflow Ids to perform retry operation on * @return bulk response object containing a list of succeeded workflows and a list of failed ones with errors */ @Service public BulkResponse retry(List<String> workflowIds) { BulkResponse bulkResponse = new BulkResponse(); for (String workflowId : workflowIds) { workflowExecutor.retry(workflowId); try { workflowExecutor.retry(workflowId); bulkResponse.appendSuccessResponse(workflowId); } catch (Exception e) { LOGGER.error("bulk retry exception, workflowId {}, message: {} ",workflowId, e.getMessage(), e); bulkResponse.appendFailedResponse(workflowId, e.getMessage()); } } return bulkResponse; }