use of org.ow2.proactive.scheduler.job.InternalJob 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.job.InternalJob 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.job.InternalJob 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();
}
use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.
the class TestJobRemove method testRuntimeDataRemoveAfterFinish.
@Test
public void testRuntimeDataRemoveAfterFinish() throws Throwable {
TaskFlowJob jobDef = createJob(2);
InternalJob job = defaultSubmitJobAndLoadInternal(false, jobDef);
dbManager.updateAfterTaskFinished(job, job.getTask("javaTask-0"), new TaskResultImpl(null, "OK1", null, 0));
dbManager.updateAfterTaskFinished(job, job.getTask("forkedJavaTask-0"), new TaskResultImpl(null, "OK2", null, 0));
dbManager.updateAfterTaskFinished(job, job.getTask("nativeTask-0"), new TaskResultImpl(null, "OK3", null, 0));
job.setStatus(JobStatus.FINISHED);
dbManager.updateAfterTaskFinished(job, null, null);
checkAllEntitiesDeleted(JobData.class.getName(), JobContent.class.getName(), TaskData.class.getName(), TaskResultData.class.getName());
// check can still load task results
Assert.assertEquals("OK1", dbManager.loadTaskResult(job.getTask("javaTask-0").getId(), 0).value());
Assert.assertEquals("OK2", dbManager.loadTaskResult(job.getTask("forkedJavaTask-0").getId(), 0).value());
Assert.assertEquals("OK3", dbManager.loadTaskResult(job.getTask("nativeTask-0").getId(), 0).value());
}
use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.
the class TestJobRemove method removeScenario.
private void removeScenario(int tasksNumber) throws Exception {
TaskFlowJob jobDef = createJob(tasksNumber);
InternalJob job = defaultSubmitJobAndLoadInternal(false, jobDef);
for (int i = 0; i < tasksNumber; i++) {
dbManager.updateAfterTaskFinished(job, job.getTask("javaTask-" + i), new TaskResultImpl(null, "OK", null, 0));
dbManager.updateAfterTaskFinished(job, job.getTask("javaTask-" + i), new TaskResultImpl(null, "OK", null, 0));
dbManager.updateAfterTaskFinished(job, job.getTask("forkedJavaTask-" + i), new TaskResultImpl(null, "OK", null, 0));
dbManager.updateAfterTaskFinished(job, job.getTask("forkedJavaTask-" + i), new TaskResultImpl(null, "OK", null, 0));
dbManager.updateAfterTaskFinished(job, job.getTask("nativeTask-" + i), new TaskResultImpl(null, "OK", null, 0));
dbManager.updateAfterTaskFinished(job, job.getTask("nativeTask-" + i), new TaskResultImpl(null, "OK", null, 0));
}
System.out.println("Remove job");
long start = System.currentTimeMillis();
dbManager.removeJob(job.getId(), 0, true);
System.out.println("Remove time (tasks: " + tasksNumber + ")" + (System.currentTimeMillis() - start));
checkAllEntitiesDeleted();
}
Aggregations