use of org.ow2.proactive.scheduler.common.JobDescriptor 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.common.JobDescriptor 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.common.JobDescriptor 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());
}
use of org.ow2.proactive.scheduler.common.JobDescriptor in project scheduling by ow2-proactive.
the class ExtendedSchedulerPolicyTest method createJobDescWithTwoTasks.
private JobDescriptor createJobDescWithTwoTasks(String jobStartAt, String oneTaskStartAt, String otherTaskStartAt) {
InternalTaskFlowJob taskFlowJob = new InternalTaskFlowJob("test", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "");
taskFlowJob.setId(JobIdImpl.makeJobId(Integer.toString(jobId++)));
ArrayList<InternalTask> tasks = new ArrayList<>();
tasks.add(createTask(oneTaskStartAt));
tasks.add(createTask(otherTaskStartAt));
taskFlowJob.addTasks(tasks);
if (jobStartAt != null) {
taskFlowJob.addGenericInformation("START_AT", jobStartAt);
}
return new JobDescriptorImpl(taskFlowJob);
}
use of org.ow2.proactive.scheduler.common.JobDescriptor 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;
}
Aggregations