Search in sources :

Example 16 with TaskStatus

use of org.ow2.proactive.scheduler.common.task.TaskStatus in project scheduling by ow2-proactive.

the class SchedulerStateRecoverHelperTest method getStringTaskStatusMap.

private Map<String, TaskStatus> getStringTaskStatusMap(InternalJob job, TaskStatus newTaskStatus) {
    List<InternalTask> tasks = job.getITasks();
    Map<String, TaskStatus> toUpdate = new HashMap<>(tasks.size());
    for (InternalTask internalTask : tasks) {
        toUpdate.put(internalTask.getName(), newTaskStatus);
    }
    return toUpdate;
}
Also used : InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) TaskStatus(org.ow2.proactive.scheduler.common.task.TaskStatus)

Example 17 with TaskStatus

use of org.ow2.proactive.scheduler.common.task.TaskStatus in project scheduling by ow2-proactive.

the class SchedulerStateRecoverHelperTest method testRecoverWithKilledJobOnly.

@Test
public void testRecoverWithKilledJobOnly() throws Exception {
    InternalJob job = createJob(JobStatus.KILLED);
    changeTasksState(job, TaskStatus.FINISHED);
    ImmutableMap<String, TaskStatus> tasksStatus = ImmutableMap.of("Ta", TaskStatus.FINISHED, "Tb", TaskStatus.ABORTED, "Tc", TaskStatus.PENDING);
    changeTasksState(job, tasksStatus);
    RecoveredSchedulerState recoveredState = new Scenario(job).execute();
    assertThat(recoveredState.getFinishedJobs().get(0).getStatus()).isEqualTo(JobStatus.KILLED);
    assertTasksStatus(recoveredState.getFinishedJobs(), 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 18 with TaskStatus

use of org.ow2.proactive.scheduler.common.task.TaskStatus in project scheduling by ow2-proactive.

the class SchedulerStateRecoverHelperTest method testRecoverWithPausedJobOnly.

@Test
public void testRecoverWithPausedJobOnly() throws Exception {
    InternalJob job = createJob(JobStatus.PAUSED);
    changeTasksState(job, TaskStatus.PAUSED);
    ImmutableMap<String, TaskStatus> tasksStatus = ImmutableMap.of("Ta", TaskStatus.FINISHED, "Tb", TaskStatus.PAUSED, "Tc", TaskStatus.PENDING);
    changeTasksState(job, tasksStatus);
    RecoveredSchedulerState recoveredState = new Scenario(job).execute();
    job = recoveredState.getRunningJobs().get(0);
    assertThat(job.getStatus()).isEqualTo(JobStatus.PAUSED);
    assertTasksStatus(job, ImmutableMap.of("Ta", TaskStatus.FINISHED, "Tb", TaskStatus.PAUSED, "Tc", TaskStatus.PAUSED));
}
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 19 with TaskStatus

use of org.ow2.proactive.scheduler.common.task.TaskStatus in project scheduling by ow2-proactive.

the class LiveJobs method restartTaskOnError.

private void restartTaskOnError(JobData jobData, InternalTask task, TaskStatus status, TaskResultImpl result, long waitTime, TerminationData terminationData) {
    InternalJob job = jobData.job;
    tlogger.info(task.getId(), "node Exclusion : restart mode is '" + task.getRestartTaskOnError() + "'");
    if (task.getRestartTaskOnError().equals(RestartMode.ELSEWHERE)) {
        task.setNodeExclusion(task.getExecuterInformation().getNodes());
    }
    task.setStatus(status);
    job.newWaitingTask();
    dbManager.updateAfterTaskFinished(job, task, result);
    listener.taskStateUpdated(job.getOwner(), new NotificationData<TaskInfo>(SchedulerEvent.TASK_WAITING_FOR_RESTART, new TaskInfoImpl((TaskInfoImpl) task.getTaskInfo())));
    terminationData.addRestartData(task.getId(), waitTime);
    logger.info("END restartTaskOnError");
}
Also used : TaskInfo(org.ow2.proactive.scheduler.common.task.TaskInfo) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskInfoImpl(org.ow2.proactive.scheduler.task.TaskInfoImpl)

Aggregations

TaskStatus (org.ow2.proactive.scheduler.common.task.TaskStatus)16 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)8 Test (org.junit.Test)7 RecoveredSchedulerState (org.ow2.proactive.scheduler.core.db.RecoveredSchedulerState)6 TaskInfo (org.ow2.proactive.scheduler.common.task.TaskInfo)5 JobId (org.ow2.proactive.scheduler.common.job.JobId)4 Query (org.hibernate.Query)3 JobState (org.ow2.proactive.scheduler.common.job.JobState)3 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)3 TaskAbortedException (org.ow2.proactive.scheduler.common.exception.TaskAbortedException)2 TaskPreemptedException (org.ow2.proactive.scheduler.common.exception.TaskPreemptedException)2 TaskRestartedException (org.ow2.proactive.scheduler.common.exception.TaskRestartedException)2 JobInfo (org.ow2.proactive.scheduler.common.job.JobInfo)2 JobStatus (org.ow2.proactive.scheduler.common.job.JobStatus)2 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)2 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)2 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Semaphore (java.util.concurrent.Semaphore)1 MutableBoolean (org.apache.commons.lang3.mutable.MutableBoolean)1