Search in sources :

Example 11 with JobDescriptor

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());
}
Also used : JobDescriptor(org.ow2.proactive.scheduler.common.JobDescriptor) EligibleTaskDescriptor(org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor) JobDescriptorImpl(org.ow2.proactive.scheduler.descriptor.JobDescriptorImpl) Test(org.junit.Test)

Example 12 with JobDescriptor

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());
}
Also used : JobDescriptor(org.ow2.proactive.scheduler.common.JobDescriptor) EligibleTaskDescriptor(org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor) JobDescriptorImpl(org.ow2.proactive.scheduler.descriptor.JobDescriptorImpl) Test(org.junit.Test)

Example 13 with JobDescriptor

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());
}
Also used : JobDescriptor(org.ow2.proactive.scheduler.common.JobDescriptor) EligibleTaskDescriptor(org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor) Test(org.junit.Test)

Example 14 with JobDescriptor

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);
}
Also used : InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) ArrayList(java.util.ArrayList) InternalTaskFlowJob(org.ow2.proactive.scheduler.job.InternalTaskFlowJob) JobDescriptorImpl(org.ow2.proactive.scheduler.descriptor.JobDescriptorImpl)

Example 15 with JobDescriptor

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;
}
Also used : TaskDescriptor(org.ow2.proactive.scheduler.common.TaskDescriptor) EligibleTaskDescriptor(org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor) JobDescriptor(org.ow2.proactive.scheduler.common.JobDescriptor) JobId(org.ow2.proactive.scheduler.common.job.JobId)

Aggregations

JobDescriptor (org.ow2.proactive.scheduler.common.JobDescriptor)24 EligibleTaskDescriptor (org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor)20 Test (org.junit.Test)15 TaskDescriptor (org.ow2.proactive.scheduler.common.TaskDescriptor)15 JobId (org.ow2.proactive.scheduler.common.job.JobId)13 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)11 JobDescriptorImpl (org.ow2.proactive.scheduler.descriptor.JobDescriptorImpl)10 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)8 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)7 ArrayList (java.util.ArrayList)6 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)5 HashMap (java.util.HashMap)4 LinkedList (java.util.LinkedList)4 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)4 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 EligibleTaskDescriptorImpl (org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptorImpl)3 IOException (java.io.IOException)2 Collection (java.util.Collection)2 TopologyDisabledException (org.ow2.proactive.resourcemanager.frontend.topology.TopologyDisabledException)2