Search in sources :

Example 16 with JobDescriptor

use of org.ow2.proactive.scheduler.common.JobDescriptor in project scheduling by ow2-proactive.

the class SchedulingServiceTest4 method testTaskRestart2.

@Test
public void testTaskRestart2() throws Exception {
    service.submitJob(createJob(createTestJob()));
    listener.assertEvents(SchedulerEvent.JOB_SUBMITTED);
    JobDescriptor jobDesc;
    jobDesc = startTask();
    service.restartTask(jobDesc.getJobId(), "javaTask", 100);
    listener.assertEvents(SchedulerEvent.JOB_PENDING_TO_RUNNING, SchedulerEvent.JOB_UPDATED, SchedulerEvent.TASK_PENDING_TO_RUNNING, SchedulerEvent.TASK_WAITING_FOR_RESTART);
    infrastructure.assertRequests(1);
    startTask();
    service.restartTask(jobDesc.getJobId(), "javaTask", 100);
    listener.assertEvents(SchedulerEvent.TASK_PENDING_TO_RUNNING, SchedulerEvent.TASK_WAITING_FOR_RESTART);
    infrastructure.assertRequests(1);
    startTask();
    service.restartTask(jobDesc.getJobId(), "javaTask", 100);
    listener.assertEvents(SchedulerEvent.TASK_PENDING_TO_RUNNING, SchedulerEvent.TASK_RUNNING_TO_FINISHED, SchedulerEvent.JOB_RUNNING_TO_FINISHED, SchedulerEvent.JOB_UPDATED);
    infrastructure.assertRequests(1);
}
Also used : JobDescriptor(org.ow2.proactive.scheduler.common.JobDescriptor) Test(org.junit.Test)

Example 17 with JobDescriptor

use of org.ow2.proactive.scheduler.common.JobDescriptor 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()));
}
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 18 with JobDescriptor

use of org.ow2.proactive.scheduler.common.JobDescriptor in project scheduling by ow2-proactive.

the class SchedulingServiceTest8 method testTaskPreempt.

@Test
public void testTaskPreempt() throws Exception {
    service.submitJob(createJob(createTestJob()));
    listener.assertEvents(SchedulerEvent.JOB_SUBMITTED);
    JobDescriptor jobDesc = startTask();
    try {
        service.preemptTask(jobDesc.getJobId(), "invalid task name", 100);
        Assert.fail();
    } catch (UnknownTaskException e) {
    }
    try {
        service.preemptTask(JobIdImpl.makeJobId("1234567"), "javaTask", 100);
        Assert.fail();
    } catch (UnknownJobException e) {
    }
    service.preemptTask(jobDesc.getJobId(), "javaTask", 100);
    listener.assertEvents(SchedulerEvent.JOB_PENDING_TO_RUNNING, SchedulerEvent.JOB_UPDATED, SchedulerEvent.TASK_PENDING_TO_RUNNING, SchedulerEvent.TASK_WAITING_FOR_RESTART);
    infrastructure.assertRequests(1);
    startTask();
    service.preemptTask(jobDesc.getJobId(), "javaTask", 100);
    listener.assertEvents(SchedulerEvent.TASK_PENDING_TO_RUNNING, SchedulerEvent.TASK_WAITING_FOR_RESTART);
    infrastructure.assertRequests(1);
    startTask();
    TaskId taskId = ((JobDescriptorImpl) jobDesc).getInternal().getTask("javaTask").getId();
    service.taskTerminatedWithResult(taskId, new TaskResultImpl(taskId, "OK", null, 0));
    listener.assertEvents(SchedulerEvent.TASK_PENDING_TO_RUNNING, SchedulerEvent.TASK_RUNNING_TO_FINISHED, SchedulerEvent.JOB_RUNNING_TO_FINISHED, SchedulerEvent.JOB_UPDATED);
    infrastructure.assertRequests(1);
    service.removeJob(jobDesc.getJobId());
    try {
        service.preemptTask(jobDesc.getJobId(), "javaTask", 100);
        Assert.fail();
    } catch (UnknownJobException e) {
    }
}
Also used : UnknownTaskException(org.ow2.proactive.scheduler.common.exception.UnknownTaskException) TaskId(org.ow2.proactive.scheduler.common.task.TaskId) TaskResultImpl(org.ow2.proactive.scheduler.task.TaskResultImpl) JobDescriptor(org.ow2.proactive.scheduler.common.JobDescriptor) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) JobDescriptorImpl(org.ow2.proactive.scheduler.descriptor.JobDescriptorImpl) Test(org.junit.Test)

Example 19 with JobDescriptor

use of org.ow2.proactive.scheduler.common.JobDescriptor in project scheduling by ow2-proactive.

the class TestJobLegacySchemas method testJobLegacySchemas.

@Test
public void testJobLegacySchemas() throws Throwable {
    log("Testing submission of job descriptor : " + jobDescriptor);
    prepareDataspaceFolder();
    String jobDescPath = new File(jobDescriptor.toURI()).getAbsolutePath();
    Job testJob = JobFactory.getFactory().createJob(jobDescPath);
    // This line prints the debug information of the job, checking that no toString method produces a NPE
    log(testJob.display());
    schedulerHelper.testJobSubmission(jobDescPath);
}
Also used : Job(org.ow2.proactive.scheduler.common.job.Job) File(java.io.File) Test(org.junit.Test)

Example 20 with JobDescriptor

use of org.ow2.proactive.scheduler.common.JobDescriptor 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());
}
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)

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