Search in sources :

Example 31 with InternalJob

use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.

the class SchedulerStateRecoverHelperTest method testRecoverWithRunningJobOnly.

@Test
public void testRecoverWithRunningJobOnly() throws Exception {
    InternalJob job = createJob(JobStatus.RUNNING);
    changeTasksState(job, TaskStatus.RUNNING);
    ImmutableMap<String, TaskStatus> tasksStatus = ImmutableMap.of("Ta", TaskStatus.ABORTED, "Tb", TaskStatus.FAULTY, "Tc", TaskStatus.PENDING);
    changeTasksState(job, tasksStatus);
    RecoveredSchedulerState recoveredState = new Scenario(job).execute();
    job = recoveredState.getRunningJobs().get(0);
    assertThat(job.getStatus()).isEqualTo(JobStatus.STALLED);
    assertTasksStatus(job, tasksStatus);
}
Also used : RecoveredSchedulerState(org.ow2.proactive.scheduler.core.db.RecoveredSchedulerState) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskStatus(org.ow2.proactive.scheduler.common.task.TaskStatus) Test(org.junit.Test)

Example 32 with InternalJob

use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.

the class SchedulerStateRecoverHelperTest method testRecoverWithCanceledJobOnly.

@Test
public void testRecoverWithCanceledJobOnly() throws Exception {
    InternalJob job = createJob(JobStatus.CANCELED);
    changeTasksState(job, TaskStatus.PENDING);
    ImmutableMap<String, TaskStatus> tasksStatus = ImmutableMap.of("Ta", TaskStatus.FINISHED, "Tb", TaskStatus.FAILED, "Tc", TaskStatus.NOT_STARTED);
    changeTasksState(job, tasksStatus);
    RecoveredSchedulerState recoveredState = new Scenario(job).execute();
    job = recoveredState.getFinishedJobs().get(0);
    assertThat(job.getStatus()).isEqualTo(JobStatus.CANCELED);
    assertTasksStatus(job, tasksStatus);
}
Also used : RecoveredSchedulerState(org.ow2.proactive.scheduler.core.db.RecoveredSchedulerState) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskStatus(org.ow2.proactive.scheduler.common.task.TaskStatus) Test(org.junit.Test)

Example 33 with InternalJob

use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.

the class SchedulerStateRecoverHelperTest method testRecoverWithPausedJobOnlyAllTasksSameStatus.

@Test
public void testRecoverWithPausedJobOnlyAllTasksSameStatus() throws Exception {
    InternalJob job = createJob(JobStatus.PAUSED);
    changeTasksState(job, TaskStatus.PAUSED);
    RecoveredSchedulerState recoveredState = new Scenario(job).execute(false);
    job = recoveredState.getPendingJobs().get(0);
    assertThat(job.getStatus()).isEqualTo(JobStatus.PAUSED);
    assertTasksStatus(job, TaskStatus.PAUSED);
}
Also used : RecoveredSchedulerState(org.ow2.proactive.scheduler.core.db.RecoveredSchedulerState) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) Test(org.junit.Test)

Example 34 with InternalJob

use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.

the class SchedulerStateRecoverHelperTest method testRecoverWithPendingJobOnly.

@Test
public void testRecoverWithPendingJobOnly() throws Exception {
    InternalJob job = createJob(JobStatus.PENDING);
    changeTasksState(job, TaskStatus.PENDING);
    RecoveredSchedulerState recoveredState = new Scenario(job).execute();
    assertTasksStatus(recoveredState.getPendingJobs(), TaskStatus.PENDING);
}
Also used : RecoveredSchedulerState(org.ow2.proactive.scheduler.core.db.RecoveredSchedulerState) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) Test(org.junit.Test)

Example 35 with InternalJob

use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.

the class BaseSchedulerDBTest method defaultSubmitJob.

public InternalJob defaultSubmitJob(TaskFlowJob job, String userName, long submittedTime) throws Exception {
    if (job.getTasks().isEmpty()) {
        job.addTask(createDefaultTask("default test task"));
    }
    InternalJob internalJob = InternalJobFactory.createJob(job, getDefaultCredentials());
    internalJob.setOwner(userName);
    internalJob.submitAction();
    if (submittedTime > 0) {
        internalJob.setSubmittedTime(submittedTime);
    }
    dbManager.newJobSubmitted(internalJob);
    return internalJob;
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob)

Aggregations

InternalJob (org.ow2.proactive.scheduler.job.InternalJob)166 Test (org.junit.Test)115 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)90 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)53 JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)36 InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)34 InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)33 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)32 JobId (org.ow2.proactive.scheduler.common.job.JobId)28 ArrayList (java.util.ArrayList)27 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)26 JavaTask (org.ow2.proactive.scheduler.common.task.JavaTask)19 RecoveredSchedulerState (org.ow2.proactive.scheduler.core.db.RecoveredSchedulerState)19 Matchers.containsString (org.hamcrest.Matchers.containsString)16 Matchers.anyString (org.mockito.Matchers.anyString)16 ExecuterInformation (org.ow2.proactive.scheduler.task.internal.ExecuterInformation)15 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)13 SchedulerStateRecoverHelper (org.ow2.proactive.scheduler.core.db.SchedulerStateRecoverHelper)12 TaskInfoImpl (org.ow2.proactive.scheduler.task.TaskInfoImpl)12 HashMap (java.util.HashMap)10