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);
}
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()));
}
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) {
}
}
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);
}
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());
}
Aggregations