use of org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor in project scheduling by ow2-proactive.
the class SchedulingServiceTest3 method testTaskKillAndJobCancel.
@Test
public void testTaskKillAndJobCancel() throws Exception {
service.submitJob(createJob(createTestJob(true)));
listener.assertEvents(SchedulerEvent.JOB_SUBMITTED);
Map<JobId, JobDescriptor> jobsMap;
JobDescriptor jobDesc;
jobsMap = service.lockJobsToSchedule();
assertEquals(1, jobsMap.size());
jobDesc = jobsMap.values().iterator().next();
Assert.assertEquals(2, jobDesc.getEligibleTasks().size());
for (TaskDescriptor taskDesc : jobDesc.getEligibleTasks()) {
taskStarted(jobDesc, (EligibleTaskDescriptor) taskDesc);
}
service.unlockJobsToSchedule(jobsMap.values());
Assert.assertTrue(service.killTask(jobDesc.getJobId(), "javaTask"));
listener.assertEvents(SchedulerEvent.JOB_PENDING_TO_RUNNING, SchedulerEvent.JOB_UPDATED, SchedulerEvent.TASK_PENDING_TO_RUNNING, SchedulerEvent.TASK_PENDING_TO_RUNNING, SchedulerEvent.TASK_RUNNING_TO_FINISHED, SchedulerEvent.TASK_RUNNING_TO_FINISHED, SchedulerEvent.JOB_RUNNING_TO_FINISHED, SchedulerEvent.JOB_UPDATED);
infrastructure.assertRequests(2);
}
use of org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor 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.descriptor.EligibleTaskDescriptor in project scheduling by ow2-proactive.
the class DefaultPolicyTest method job_with_different_priorities.
@Test
public void job_with_different_priorities() throws Exception {
JobDescriptorImpl jobHigh = createSingleTaskJob(JobPriority.HIGH);
JobDescriptorImpl jobLow = createSingleTaskJob(JobPriority.LOW);
JobDescriptorImpl jobNormal = createSingleTaskJob(JobPriority.NORMAL);
List<JobDescriptor> jobs = submitJobs(jobHigh, jobLow, jobNormal);
LinkedList<EligibleTaskDescriptor> orderedTasks = new DefaultPolicy().getOrderedTasks(jobs);
assertEquals(jobHigh.getJobId(), orderedTasks.get(0).getJobId());
assertEquals(jobNormal.getJobId(), orderedTasks.get(1).getJobId());
assertEquals(jobLow.getJobId(), orderedTasks.get(2).getJobId());
}
use of org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor in project scheduling by ow2-proactive.
the class DefaultPolicyTest method single_job.
@Test
public void single_job() throws Exception {
JobDescriptorImpl job = createSingleTaskJob();
List<JobDescriptor> jobs = submitJobs(job);
LinkedList<EligibleTaskDescriptor> orderedTasks = new DefaultPolicy().getOrderedTasks(jobs);
assertEquals(1, orderedTasks.size());
}
use of org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor in project scheduling by ow2-proactive.
the class ExtendedSchedulerPolicyTest method job_with_same_priorities.
@Test
public void job_with_same_priorities() throws Exception {
JobDescriptor job1 = createJobDescWithTwoTasks(null, null, null);
JobDescriptor job2 = createJobDescWithTwoTasks(null, null, null);
JobDescriptor job3 = createJobDescWithTwoTasks(null, null, null);
List<JobDescriptor> jobDescList = asModifiableList(job1, job3, job2);
LinkedList<EligibleTaskDescriptor> orderedTasks = policy.getOrderedTasks(jobDescList);
assertEquals(job1.getJobId(), orderedTasks.get(0).getJobId());
assertEquals(job2.getJobId(), orderedTasks.get(2).getJobId());
assertEquals(job3.getJobId(), orderedTasks.get(4).getJobId());
}
Aggregations