@Override protected Object clone() throws CloneNotSupportedException { PipelineExecutorTaskImpl clone = new PipelineExecutorTaskImpl(taskDef, executionId); clone.setPipelineStatus(this.getPipelineStatus()); stageStatus.forEach(clone::setStageStatus); stageError.forEach(clone::setStageError); clone.setPipelineError(pipelineError); clone.setOutput(output); return clone; } }
@Override protected Object clone() throws CloneNotSupportedException { PipelineExecutorTaskImpl clone = new PipelineExecutorTaskImpl(taskDef, executionId); clone.setPipelineStatus(this.getPipelineStatus()); stageStatus.forEach(clone::setStageStatus); stageError.forEach(clone::setStageError); clone.setPipelineError(pipelineError); clone.setOutput(output); return clone; } }
private void beforePipelineExecution(final BeforePipelineExecutionEvent bpee, final TaskEntry taskEntry) { taskEntry.getTask().setPipelineStatus(PipelineExecutorTask.Status.RUNNING); if (taskEntry.isAsync()) { updateExecutorRegistry(taskEntry.getTask()); } }
private void beforePipelineExecution(final BeforePipelineExecutionEvent bpee, final TaskEntry taskEntry) { taskEntry.getTask().setPipelineStatus(PipelineExecutorTask.Status.RUNNING); if (taskEntry.isAsync()) { updateExecutorRegistry(taskEntry.getTask()); } }
private void afterPipelineExecution(final AfterPipelineExecutionEvent apee, final TaskEntry taskEntry) { taskEntry.getTask().setPipelineStatus(PipelineExecutorTask.Status.FINISHED); if (taskEntry.isAsync()) { updateExecutorRegistry(taskEntry.getTask()); } }
private void afterPipelineExecution(final AfterPipelineExecutionEvent apee, final TaskEntry taskEntry) { taskEntry.getTask().setPipelineStatus(PipelineExecutorTask.Status.FINISHED); if (taskEntry.isAsync()) { updateExecutorRegistry(taskEntry.getTask()); } }
public void setTaskInStoppedStatus(final PipelineExecutorTaskImpl task) { task.setPipelineStatus(PipelineExecutorTask.Status.STOPPED); task.getTaskDef().getStages() .stream() .filter(stage -> PipelineExecutorTask.Status.RUNNING.equals(task.getStageStatus(stage)) || PipelineExecutorTask.Status.SCHEDULED.equals(task.getStageStatus(stage))) .forEach(stage -> task.setStageStatus(stage, PipelineExecutorTask.Status.STOPPED)); task.clearErrors(); task.setOutput(null); } }
public void setTaskInStoppedStatus(final PipelineExecutorTaskImpl task) { task.setPipelineStatus(PipelineExecutorTask.Status.STOPPED); task.getTaskDef().getStages() .stream() .filter(stage -> PipelineExecutorTask.Status.RUNNING.equals(task.getStageStatus(stage)) || PipelineExecutorTask.Status.SCHEDULED.equals(task.getStageStatus(stage))) .forEach(stage -> task.setStageStatus(stage, PipelineExecutorTask.Status.STOPPED)); task.clearErrors(); task.setOutput(null); } }
private void testBeforePipelineExecutionEvent(boolean async) { when(taskEntry.isAsync()).thenReturn(async); BeforePipelineExecutionEvent event = new BeforePipelineExecutionEvent(TASK_ID, pipeline); taskManager.localListener.beforePipelineExecution(event); verify(task, times(1)).setPipelineStatus(PipelineExecutorTask.Status.RUNNING); verifyExecutorRegistryUpdated(async); verifyExternalListenersNotified(event); }
private void testAfterPipelineExecutionEvent(boolean async) { when(taskEntry.isAsync()).thenReturn(async); AfterPipelineExecutionEvent event = new AfterPipelineExecutionEvent(TASK_ID, pipeline); taskManager.localListener.afterPipelineExecution(event); verify(task, times(1)).setPipelineStatus(PipelineExecutorTask.Status.FINISHED); verifyExecutorRegistryUpdated(async); verifyExternalListenersNotified(event); }
private void testBeforePipelineExecutionEvent(boolean async) { when(taskEntry.isAsync()).thenReturn(async); BeforePipelineExecutionEvent event = new BeforePipelineExecutionEvent(TASK_ID, pipeline); taskManager.localListener.beforePipelineExecution(event); verify(task, times(1)).setPipelineStatus(PipelineExecutorTask.Status.RUNNING); verifyExecutorRegistryUpdated(async); verifyExternalListenersNotified(event); }
private void testAfterPipelineExecutionEvent(boolean async) { when(taskEntry.isAsync()).thenReturn(async); AfterPipelineExecutionEvent event = new AfterPipelineExecutionEvent(TASK_ID, pipeline); taskManager.localListener.afterPipelineExecution(event); verify(task, times(1)).setPipelineStatus(PipelineExecutorTask.Status.FINISHED); verifyExecutorRegistryUpdated(async); verifyExternalListenersNotified(event); }
private void onPipelineError(final OnErrorPipelineExecutionEvent oepee, final TaskEntry taskEntry) { taskEntry.getTask().setPipelineStatus(PipelineExecutorTask.Status.ERROR); taskEntry.getTask().setPipelineError(new PipelineExecutorException(oepee.getError().getMessage(), oepee.getError())); if (taskEntry.isAsync()) { updateExecutorRegistry(taskEntry.getTask()); } }
private void onPipelineError(final OnErrorPipelineExecutionEvent oepee, final TaskEntry taskEntry) { taskEntry.getTask().setPipelineStatus(PipelineExecutorTask.Status.ERROR); taskEntry.getTask().setPipelineError(new PipelineExecutorError(oepee.getError().getMessage(), oepee.getError())); if (taskEntry.isAsync()) { updateExecutorRegistry(taskEntry.getTask()); } }
private void testOnPipelineErrorExecutionEvent(boolean async) { when(taskEntry.isAsync()).thenReturn(async); OnErrorPipelineExecutionEvent event = new OnErrorPipelineExecutionEvent(TASK_ID, pipeline, stage, error); taskManager.localListener.onPipelineError(event); verify(task, times(1)).setPipelineStatus(PipelineExecutorTask.Status.ERROR); verify(task, times(1)).setPipelineError(pipelineExecutorErrorCaptor.capture()); assertEquals(new PipelineExecutorError(ERROR_MESSAGE, error), pipelineExecutorErrorCaptor.getValue()); verifyExecutorRegistryUpdated(async); verifyExternalListenersNotified(event); }
private void testOnPipelineErrorExecutionEvent(boolean async) { when(taskEntry.isAsync()).thenReturn(async); OnErrorPipelineExecutionEvent event = new OnErrorPipelineExecutionEvent(TASK_ID, pipeline, stage, error); taskManager.localListener.onPipelineError(event); verify(task, times(1)).setPipelineStatus(PipelineExecutorTask.Status.ERROR); verify(task, times(1)).setPipelineError(pipelineExecutorExceptionCaptor.capture()); assertEqualsException(new PipelineExecutorException(ERROR_MESSAGE, error), pipelineExecutorExceptionCaptor.getValue()); verifyExecutorRegistryUpdated(async); verifyExternalListenersNotified(event); }
private void onStageError(final OnErrorStageExecutionEvent oesee, final TaskEntry taskEntry) { taskEntry.getTask().setPipelineStatus(PipelineExecutorTask.Status.ERROR); taskEntry.getTask().setStageStatus(oesee.getStage().getName(), PipelineExecutorTask.Status.ERROR); taskEntry.getTask().setStageError(oesee.getStage().getName(), new PipelineExecutorException(oesee.getError().getMessage(), oesee.getError())); if (taskEntry.isAsync()) { updateExecutorRegistry(taskEntry.getTask()); } }
private void onStageError(final OnErrorStageExecutionEvent oesee, final TaskEntry taskEntry) { taskEntry.getTask().setPipelineStatus(PipelineExecutorTask.Status.ERROR); taskEntry.getTask().setStageStatus(oesee.getStage().getName(), PipelineExecutorTask.Status.ERROR); taskEntry.getTask().setStageError(oesee.getStage().getName(), new PipelineExecutorError(oesee.getError().getMessage(), oesee.getError())); if (taskEntry.isAsync()) { updateExecutorRegistry(taskEntry.getTask()); } }
@Override public PipelineExecutorTraceImpl getValue() { //only the stage names are used by the taskDef, so the pipeline can be mocked. List<Stage> stages = mockStages(STAGE_COUNT); Pipeline pipeline = new BasePipeline(PIPELINE_NAME, stages) { }; Input input = mockInput(PIPELINE_INPUT_SIZE); PipelineExecutorTaskDefImpl taskDef = new PipelineExecutorTaskDefImpl(pipeline, input); PipelineExecutorTaskImpl taskImpl = new PipelineExecutorTaskImpl(taskDef, PIPELINE_EXECUTION_ID); taskImpl.setPipelineStatus(PipelineExecutorTask.Status.SCHEDULED); taskImpl.setPipelineError(mockError(PIPELINE_ERROR, PIPELINE_ERROR_DETAIL)); taskImpl.getTaskDef().getStages().forEach(stage -> taskImpl.setStageError(stage, mockStageError(stage))); taskImpl.setOutput(new MockPipelineOutput(PIPELINE_OUTPUT)); return new PipelineExecutorTraceImpl(taskImpl); }
@Override public PipelineExecutorTraceImpl getValue() { //only the stage names are used by the taskDef, so the pipeline can be mocked. List<Stage> stages = mockStages(STAGE_COUNT); Pipeline pipeline = new BasePipeline(PIPELINE_NAME, stages); Input input = mockInput(PIPELINE_INPUT_SIZE); PipelineExecutorTaskDefImpl taskDef = new PipelineExecutorTaskDefImpl(pipeline, input); PipelineExecutorTaskImpl taskImpl = new PipelineExecutorTaskImpl(taskDef, PIPELINE_EXECUTION_ID); taskImpl.setPipelineStatus(PipelineExecutorTask.Status.SCHEDULED); taskImpl.setPipelineError(mockError(PIPELINE_ERROR)); taskImpl.getTaskDef().getStages().forEach(stage -> taskImpl.setStageError(stage, mockStageError(stage))); taskImpl.setOutput(new MockPipelineOutput(PIPELINE_OUTPUT)); return new PipelineExecutorTraceImpl(taskImpl); }