/** * Restarts a completed workflow. * * @param workflowId WorkflowId of the workflow. * @param useLatestDefinitions if true, use the latest workflow and task definitions upon restart */ @Service public void restartWorkflow(String workflowId, boolean useLatestDefinitions) { workflowExecutor.rewind(workflowId, useLatestDefinitions); }
/** * Restart the list of workflows. * * @param workflowIds - list of workflow Ids to perform restart operation on * @param useLatestDefinitions if true, use latest workflow and task definitions upon restart * @return bulk response object containing a list of succeeded workflows and a list of failed ones with errors */ @Service public BulkResponse restart(List<String> workflowIds, boolean useLatestDefinitions) { BulkResponse bulkResponse = new BulkResponse(); for (String workflowId : workflowIds) { workflowExecutor.rewind(workflowId, useLatestDefinitions); try { workflowExecutor.rewind(workflowId, useLatestDefinitions); bulkResponse.appendSuccessResponse(workflowId); } catch (Exception e) { LOGGER.error("bulk restart exception, workflowId {}, message: {} ",workflowId, e.getMessage(), e); bulkResponse.appendFailedResponse(workflowId, e.getMessage()); } } return bulkResponse; }
@Test public void testRestartWorkflow() { workflowService.restartWorkflow("w123", false); verify(mockWorkflowExecutor, times(1)).rewind(anyString(), anyBoolean()); }
when(executionDAOFacade.updateWorkflow(any())).thenReturn(""); workflowExecutor.rewind(workflow.getWorkflowId(), false); assertEquals(Workflow.WorkflowStatus.RUNNING, workflow.getStatus()); verify(metadataDAO, never()).getLatest(any()); workflowExecutor.rewind(workflow.getWorkflowId(), true); assertEquals(Workflow.WorkflowStatus.RUNNING, workflow.getStatus()); verify(metadataDAO, times(1)).getLatest(anyString());
workflowExecutor.rewind(workflowInstanceId, false); } catch (ApplicationException ae) { failed = true;
workflowExecutor.rewind(workflowInstanceId, false); } catch (ApplicationException ae) { failed = true;
/** * Restarts a completed workflow. * * @param workflowId WorkflowId of the workflow. * @param useLatestDefinitions if true, use the latest workflow and task definitions upon restart */ @Service public void restartWorkflow(String workflowId, boolean useLatestDefinitions) { workflowExecutor.rewind(workflowId, useLatestDefinitions); }
/** * Restart the list of workflows. * * @param workflowIds - list of workflow Ids to perform restart operation on * @param useLatestDefinitions if true, use latest workflow and task definitions upon restart * @return bulk response object containing a list of succeeded workflows and a list of failed ones with errors */ @Service public BulkResponse restart(List<String> workflowIds, boolean useLatestDefinitions) { BulkResponse bulkResponse = new BulkResponse(); for (String workflowId : workflowIds) { workflowExecutor.rewind(workflowId, useLatestDefinitions); try { workflowExecutor.rewind(workflowId, useLatestDefinitions); bulkResponse.appendSuccessResponse(workflowId); } catch (Exception e) { LOGGER.error("bulk restart exception, workflowId {}, message: {} ",workflowId, e.getMessage(), e); bulkResponse.appendFailedResponse(workflowId, e.getMessage()); } } return bulkResponse; }