use of org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor in project scheduling by ow2-proactive.
the class SchedulingServiceTest4 method startTask.
private JobDescriptor startTask() throws Exception {
Map<JobId, JobDescriptor> jobsMap;
JobDescriptor jobDesc;
jobsMap = service.lockJobsToSchedule();
assertEquals(1, jobsMap.size());
jobDesc = jobsMap.values().iterator().next();
Assert.assertEquals(1, jobDesc.getEligibleTasks().size());
for (TaskDescriptor taskDesc : jobDesc.getEligibleTasks()) {
taskStarted(jobDesc, (EligibleTaskDescriptor) taskDesc);
}
service.unlockJobsToSchedule(jobsMap.values());
return jobDesc;
}
use of org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor in project scheduling by ow2-proactive.
the class SchedulingServiceTest5 method testJobKill.
@Test
public void testJobKill() throws Exception {
service.submitJob(createJob(createTestJob()));
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.killJob(jobDesc.getJobId()));
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);
Assert.assertFalse(service.killJob(jobDesc.getJobId()));
}
use of org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor in project scheduling by ow2-proactive.
the class TaskResultCreatorTest method mockedPausedOrRunningTaskMap.
private Map<TaskId, EligibleTaskDescriptor> mockedPausedOrRunningTaskMap() {
EligibleTaskDescriptor eligibleTaskDescriptor = this.createEligibleTaskDescriptor(this.createParentVector());
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 TaskResultCreatorTest method createEligibleTaskDescriptor.
private EligibleTaskDescriptor createEligibleTaskDescriptor(Vector<TaskDescriptor> fakeParentVector) {
EligibleTaskDescriptorImpl mockedEligibleTaskDescriptorImpl = mock(EligibleTaskDescriptorImpl.class);
when(mockedEligibleTaskDescriptorImpl.getParents()).thenReturn(fakeParentVector);
return mockedEligibleTaskDescriptorImpl;
}
use of org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor in project scheduling by ow2-proactive.
the class DefaultPolicyTest method job_with_same_priorities.
@Test
public void job_with_same_priorities() throws Exception {
JobDescriptorImpl job1 = createSingleTaskJob();
JobDescriptorImpl job2 = createSingleTaskJob();
JobDescriptorImpl job3 = createSingleTaskJob();
List<JobDescriptor> jobs = submitJobs(job1, job3, job2);
LinkedList<EligibleTaskDescriptor> orderedTasks = new DefaultPolicy().getOrderedTasks(jobs);
assertEquals(job1.getJobId(), orderedTasks.get(0).getJobId());
assertEquals(job2.getJobId(), orderedTasks.get(1).getJobId());
assertEquals(job3.getJobId(), orderedTasks.get(2).getJobId());
}
Aggregations