@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; } }
if (entry.isAsync()) { final PipelineExecutorTaskImpl task = entry.getTask(); if (stopEnabledStatus.contains(task.getPipelineStatus())) { try { taskManagerHelper.setTaskInStoppedStatus(task);
if (entry.isAsync()) { final PipelineExecutorTaskImpl task = entry.getTask(); if (stopEnabledStatus.contains(task.getPipelineStatus())) { try { taskManagerHelper.setTaskInStoppedStatus(task);
private void testStopTaskInNonStopeableState(PipelineExecutorTask.Status notStopeableStatus) throws PipelineExecutorException { PipelineExecutorTaskImpl task = mock(PipelineExecutorTaskImpl.class); when(task.getId()).thenReturn(TASK_ID); when(task.getPipelineStatus()).thenReturn(notStopeableStatus); PipelineExecutorTaskManagerImpl.TaskEntry taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class); when(taskEntry.isAsync()).thenReturn(true); when(taskEntry.getTask()).thenReturn(task); taskManager.currentTasks.put(TASK_ID, taskEntry); taskManager.init(); expectedException.expectMessage(new StartsWith("A PipelineExecutorTask in status: " + notStopeableStatus.name() + " can not be stopped. Stop operation is available for the following status set:")); taskManager.stop(TASK_ID); }
private void testStopTaskInNonStopeableState(PipelineExecutorTask.Status notStopeableStatus) throws PipelineExecutorException { PipelineExecutorTaskImpl task = mock(PipelineExecutorTaskImpl.class); when(task.getId()).thenReturn(TASK_ID); when(task.getPipelineStatus()).thenReturn(notStopeableStatus); PipelineExecutorTaskManagerImpl.TaskEntry taskEntry = mock(PipelineExecutorTaskManagerImpl.TaskEntry.class); when(taskEntry.isAsync()).thenReturn(true); when(taskEntry.getTask()).thenReturn(task); taskManager.currentTasks.put(TASK_ID, taskEntry); taskManager.init(); expectedException.expectMessage(new StartsWith("A PipelineExecutorTask in status: " + notStopeableStatus.name() + " can not be stopped. Stop operation is available for the following status set:")); taskManager.stop(TASK_ID); }
when(task.clone()).thenReturn(task); when(task.getId()).thenReturn(taskId); when(task.getPipelineStatus()).thenReturn(PipelineExecutorTask.Status.RUNNING); PipelineExecutorTaskDef taskDef = mock(PipelineExecutorTaskDef.class); when(task.getTaskDef()).thenReturn(taskDef);
when(task.clone()).thenReturn(task); when(task.getId()).thenReturn(taskId); when(task.getPipelineStatus()).thenReturn(PipelineExecutorTask.Status.RUNNING); PipelineExecutorTaskDef taskDef = mock(PipelineExecutorTaskDef.class); when(task.getTaskDef()).thenReturn(taskDef);
@Override public void stop(final String taskId) throws PipelineExecutorException { final TaskEntry entry = getTaskEntry(taskId); if (entry == null) { throw new PipelineExecutorException("No PipelineExecutorTask was found for taskId: " + taskId); } if (!entry.isAsync()) { throw new PipelineExecutorException("Stop operation is not available for taskId: " + taskId + " running in SYNCHRONOUS mode"); } final PipelineExecutorTask.Status currentStatus = entry.getTask().getPipelineStatus(); if (!stopEnabledStatus.contains(currentStatus)) { throw new PipelineExecutorException("A PipelineExecutorTask in status: " + currentStatus.name() + " can not" + " be stopped. Stop operation is available for the following status set: " + stopEnabledStatus); } destroyFutureTask(taskId); removeTaskEntry(taskId); taskManagerHelper.setTaskInStoppedStatus(entry.getTask()); updateExecutorRegistry(entry.getTask()); }
@Override public void stop(final String taskId) throws PipelineExecutorException { final TaskEntry entry = getTaskEntry(taskId); if (entry == null) { throw new PipelineExecutorException("No PipelineExecutorTask was found for taskId: " + taskId); } if (!entry.isAsync()) { throw new PipelineExecutorException("Stop operation is not available for taskId: " + taskId + " running in SYNCHRONOUS mode"); } final PipelineExecutorTask.Status currentStatus = entry.getTask().getPipelineStatus(); if (!stopEnabledStatus.contains(currentStatus)) { throw new PipelineExecutorException("A PipelineExecutorTask in status: " + currentStatus.name() + " can not" + " be stopped. Stop operation is available for the following status set: " + stopEnabledStatus); } destroyFutureTask(taskId); removeTaskEntry(taskId); taskManagerHelper.setTaskInStoppedStatus(entry.getTask()); updateExecutorRegistry(entry.getTask()); }