Search in sources :

Example 46 with TaskFlowJob

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());
    }
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) Test(org.junit.Test)

Example 47 with TaskFlowJob

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());
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) Test(org.junit.Test)

Example 48 with TaskFlowJob

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());
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) Test(org.junit.Test)

Example 49 with TaskFlowJob

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());
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) Test(org.junit.Test)

Example 50 with TaskFlowJob

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();
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) Test(org.junit.Test)

Aggregations

TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)184 JavaTask (org.ow2.proactive.scheduler.common.task.JavaTask)92 Test (org.junit.Test)81 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)49 JobId (org.ow2.proactive.scheduler.common.job.JobId)33 File (java.io.File)31 ForkEnvironment (org.ow2.proactive.scheduler.common.task.ForkEnvironment)25 NativeTask (org.ow2.proactive.scheduler.common.task.NativeTask)22 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)21 SimpleScript (org.ow2.proactive.scripting.SimpleScript)20 JobResult (org.ow2.proactive.scheduler.common.job.JobResult)18 ScriptTask (org.ow2.proactive.scheduler.common.task.ScriptTask)16 Task (org.ow2.proactive.scheduler.common.task.Task)16 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)13 TaskScript (org.ow2.proactive.scripting.TaskScript)13 JobState (org.ow2.proactive.scheduler.common.job.JobState)12 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)12 ArrayList (java.util.ArrayList)11 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)11 HashMap (java.util.HashMap)10