use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.
the class SchedulingServiceTest method testScheduleJobRemoveShouldUseHousekeepingButAlreadyRemoved.
@Test
public void testScheduleJobRemoveShouldUseHousekeepingButAlreadyRemoved() {
Mockito.when(schedulerDBManager.loadJobWithTasksIfNotRemoved(any(JobId.class))).thenReturn(Collections.<InternalJob>emptyList());
JobId jobId = JobIdImpl.makeJobId("42");
schedulingService.scheduleJobRemove(jobId, 42);
Mockito.verify(schedulerDBManager).loadJobWithTasksIfNotRemoved(jobId);
}
use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.
the class SchedulingServiceTest method testRestartTaskOnNodeFailure.
@Test
public void testRestartTaskOnNodeFailure() {
InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
InternalTask task = new InternalScriptTask(job);
ExecutorService executorService = Mockito.mock(ExecutorService.class);
Mockito.when(infrastructure.getInternalOperationsThreadPool()).thenReturn(executorService);
schedulingService.restartTaskOnNodeFailure(task);
Mockito.verify(executorService, Mockito.times(1)).submit(any(Runnable.class));
}
use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.
the class SchedulingServiceTest method testScheduleJobRemoveShouldUseHousekeeping.
@Test
public void testScheduleJobRemoveShouldUseHousekeeping() {
JobId jobId = JobIdImpl.makeJobId("42");
InternalJob mockedInternalJob = createMockedInternalJob(jobId);
Mockito.when(schedulerDBManager.loadJobWithTasksIfNotRemoved(any(JobId.class))).thenReturn(Collections.singletonList(mockedInternalJob));
schedulingService.scheduleJobRemove(jobId, 42);
// second case: the job is not null
Mockito.verify(schedulerDBManager).loadJobWithTasksIfNotRemoved(jobId);
Mockito.verify(schedulerDBManager).scheduleJobForRemoval(eq(jobId), eq(42L), anyBoolean());
}
use of org.ow2.proactive.scheduler.job.InternalJob 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.job.InternalJob in project scheduling by ow2-proactive.
the class TaskResultCreatorTest method getMockedInternalJobTaskFlowType.
private InternalJob getMockedInternalJobTaskFlowType(JobDescriptorImpl mockedJobDescriptor) {
InternalJob mockedInternalJob = mock(InternalJob.class);
when(mockedInternalJob.getJobDescriptor()).thenReturn(mockedJobDescriptor);
when(mockedInternalJob.getType()).thenReturn(JobType.TASKSFLOW);
when(mockedInternalJob.getVariables()).thenReturn(new HashMap<String, JobVariable>());
return mockedInternalJob;
}
Aggregations