use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestJobAttributes method testJobIdGeneration.
@Test
public void testJobIdGeneration() throws Exception {
// test job ids are sequential
for (int i = 0; i < 5; i++) {
TaskFlowJob jobDef = new TaskFlowJob();
for (int j = 0; j < 10; j++) {
jobDef.addTask(createDefaultTask("task" + j));
}
InternalJob job = defaultSubmitJob(jobDef);
Assert.assertEquals(String.valueOf(i + 1), job.getId().value());
}
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestJobOperations method testSetToBeRemoved.
@Test
public void testSetToBeRemoved() throws Exception {
InternalJob job = defaultSubmitJobAndLoadInternal(false, new TaskFlowJob());
Assert.assertFalse(job.isToBeRemoved());
job.setToBeRemoved();
System.out.println("Set job to be removed");
dbManager.jobSetToBeRemoved(job.getId());
job = recoverJob();
Assert.assertTrue(job.isToBeRemoved());
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestJobOperations method testPause.
@Test
public void testPause() throws Exception {
InternalJob job = defaultSubmitJobAndLoadInternal(false, new TaskFlowJob());
Assert.assertEquals(JobStatus.PENDING, job.getStatus());
job.setPaused();
dbManager.updateJobAndTasksState(job);
job = recoverJob();
Assert.assertEquals(JobStatus.PAUSED, job.getStatus());
Assert.assertEquals(TaskStatus.PAUSED, job.getTasks().get(0).getStatus());
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestJobOperations method testLoadJobWithTasksIfNotRemoved.
@Test
public void testLoadJobWithTasksIfNotRemoved() throws Exception {
TaskFlowJob jobDef = new TaskFlowJob();
jobDef.addTask(createDefaultTask("task1"));
jobDef.addTask(createDefaultTask("task2"));
jobDef.addTask(createDefaultTask("task3"));
jobDef.setPriority(JobPriority.HIGHEST);
InternalJob job = defaultSubmitJob(jobDef, "user1");
List<InternalJob> jobs = dbManager.loadJobWithTasksIfNotRemoved(job.getId());
Assert.assertEquals(1, jobs.size());
job = jobs.get(0);
Assert.assertEquals(3, job.getTasks().size());
Assert.assertEquals("user1", job.getOwner());
Assert.assertEquals(3, job.getJobInfo().getTotalNumberOfTasks());
Assert.assertEquals(0, job.getJobInfo().getNumberOfFinishedTasks());
Assert.assertEquals(0, job.getJobInfo().getNumberOfRunningTasks());
Assert.assertEquals(0, job.getJobInfo().getNumberOfPendingTasks());
Assert.assertEquals(JobStatus.PENDING, job.getJobInfo().getStatus());
Assert.assertEquals(JobPriority.HIGHEST, job.getJobInfo().getPriority());
dbManager.removeJob(job.getId(), System.currentTimeMillis(), false);
Assert.assertTrue(dbManager.loadJobWithTasksIfNotRemoved(job.getId()).isEmpty());
Assert.assertTrue(dbManager.loadJobWithTasksIfNotRemoved(JobIdImpl.makeJobId("123456789")).isEmpty());
}
use of org.ow2.proactive.scheduler.common.job.TaskFlowJob in project scheduling by ow2-proactive.
the class TestJobRemove method testFullDataRemove1.
@Test
public void testFullDataRemove1() throws Exception {
TaskFlowJob jobDef = new TaskFlowJob();
JavaTask task1 = new JavaTask();
task1.setName("task1");
task1.setExecutableClassName(TestDummyExecutable.class.getName());
jobDef.addTask(task1);
InternalJob job = defaultSubmitJob(jobDef);
System.out.println("Remove job");
long start = System.currentTimeMillis();
dbManager.removeJob(job.getId(), 0, true);
System.out.println("Remove time (single task)" + (System.currentTimeMillis() - start));
checkAllEntitiesDeleted();
}
Aggregations