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;
}
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);
}
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));
}
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");
}
Aggregations