Search in sources :

Example 11 with EligibleTaskDescriptor

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);
}
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) Test(org.junit.Test)

Example 12 with EligibleTaskDescriptor

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

Example 13 with EligibleTaskDescriptor

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());
}
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 14 with EligibleTaskDescriptor

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());
}
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 15 with EligibleTaskDescriptor

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

Aggregations

EligibleTaskDescriptor (org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor)25 JobDescriptor (org.ow2.proactive.scheduler.common.JobDescriptor)18 TaskDescriptor (org.ow2.proactive.scheduler.common.TaskDescriptor)16 JobId (org.ow2.proactive.scheduler.common.job.JobId)12 Test (org.junit.Test)10 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)9 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)8 JobDescriptorImpl (org.ow2.proactive.scheduler.descriptor.JobDescriptorImpl)7 EligibleTaskDescriptorImpl (org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptorImpl)6 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)5 ArrayList (java.util.ArrayList)4 LinkedList (java.util.LinkedList)4 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)3 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)3 IOException (java.io.IOException)2 Collection (java.util.Collection)2 Entry (java.util.Map.Entry)2 TopologyDisabledException (org.ow2.proactive.resourcemanager.frontend.topology.TopologyDisabledException)2 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)2 RMProxyCreationException (org.ow2.proactive.scheduler.core.rmproxies.RMProxyCreationException)2