use of org.ow2.proactive.scheduler.common.task.TaskId in project scheduling by ow2-proactive.
the class TerminationDataTest method testHandleTerminationForTaskNodeFailureTermination.
@Test
public void testHandleTerminationForTaskNodeFailureTermination() throws IOException, ClassNotFoundException {
InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
JobId jobId = new JobIdImpl(666, "readableName");
InternalTask internalTask = new InternalScriptTask(job);
TaskId taskId = TaskIdImpl.createTaskId(jobId, "task-name", 777L);
internalTask.setId(taskId);
internalTask.setName("task-name");
internalTask.setStatus(TaskStatus.RUNNING);
internalTask.setExecuterInformation(Mockito.mock(ExecuterInformation.class));
RunningTaskData taskData = new RunningTaskData(internalTask, "user", null, launcher);
terminationData.addTaskData(null, taskData, TerminationData.TerminationStatus.NODEFAILED, null);
terminationData.handleTermination(service);
Mockito.verify(launcher, Mockito.times(0)).kill();
}
use of org.ow2.proactive.scheduler.common.task.TaskId in project scheduling by ow2-proactive.
the class TaskResultCreatorTest method testPausedTasksAreCheckedForATaskId.
@Test
public void testPausedTasksAreCheckedForATaskId() throws UnknownTaskException {
TaskResultCreator taskResultCreator = new TaskResultCreator();
TaskResultImpl mockedTaskResultImpl = mock(TaskResultImpl.class);
Map<TaskId, TaskResult> loadTaskResultsValue = new HashMap<>();
loadTaskResultsValue.put(this.createTaskID(), mockedTaskResultImpl);
SchedulerDBManager mockedschedulerDbManager = mock(SchedulerDBManager.class);
when(mockedschedulerDbManager.loadTasksResults(any(JobId.class), any(List.class))).thenReturn(loadTaskResultsValue);
JobDescriptorImpl mockedJobDescriptorHasPausedTask = this.getMockedJobDescriptorWithPausedTask();
taskResultCreator.getTaskResult(mockedschedulerDbManager, this.getMockedInternalJob(mockedJobDescriptorHasPausedTask), this.getMockedInternalTask());
verify(mockedJobDescriptorHasPausedTask, atLeastOnce()).getPausedTasks();
}
use of org.ow2.proactive.scheduler.common.task.TaskId in project scheduling by ow2-proactive.
the class TaskResultCreatorTest method mockedPausedOrRunningTaskMapWithoutParentTasks.
private Map<TaskId, EligibleTaskDescriptor> mockedPausedOrRunningTaskMapWithoutParentTasks() {
EligibleTaskDescriptor eligibleTaskDescriptor = this.createEligibleTaskDescriptor(new Vector<TaskDescriptor>());
Map<TaskId, EligibleTaskDescriptor> mockedMap = mock(HashMap.class);
when(mockedMap.get(any())).thenReturn(eligibleTaskDescriptor);
return mockedMap;
}
use of org.ow2.proactive.scheduler.common.task.TaskId in project scheduling by ow2-proactive.
the class TaskResultCreatorTest method testThatNotFoundTaskResultIsHandled.
@Test
public void testThatNotFoundTaskResultIsHandled() throws UnknownTaskException {
TaskResultCreator taskResultCreator = new TaskResultCreator();
TaskResultImpl mockedTaskResultImpl = mock(TaskResultImpl.class);
Map<TaskId, TaskResult> loadTaskResultsValue = new HashMap<>();
loadTaskResultsValue.put(this.createTaskID(), mockedTaskResultImpl);
SchedulerDBManager mockedschedulerDbManager = mock(SchedulerDBManager.class);
when(mockedschedulerDbManager.loadTasksResults(any(JobId.class), any(List.class))).thenThrow(DatabaseManagerException.class);
taskResultCreator.getTaskResult(mockedschedulerDbManager, this.getMockedInternalJob(this.getMockedJobDescriptorWithPausedTask()), this.getMockedInternalTask());
}
use of org.ow2.proactive.scheduler.common.task.TaskId in project scheduling by ow2-proactive.
the class TaskResultCreatorTest method createParentTaskDescriptor.
private EligibleTaskDescriptorImpl createParentTaskDescriptor() {
EligibleTaskDescriptorImpl mockedEligibleTaskDescriptorImpl = mock(EligibleTaskDescriptorImpl.class);
TaskId parentId = this.createParentTaskID();
doReturn(parentId).when(mockedEligibleTaskDescriptorImpl).getTaskId();
return mockedEligibleTaskDescriptorImpl;
}
Aggregations