use of org.ow2.proactive.scheduler.common.task.TaskStatus in project scheduling by ow2-proactive.
the class TaskDBUtils method fetchTaskData.
private static List<TaskData> fetchTaskData(Session session, DBTaskDataParameters params) {
Set<TaskStatus> taskStatuses = params.getStatuses();
boolean hasUser = params.hasUser();
boolean hasTag = params.hasTag();
boolean hasDateFrom = params.hasDateFrom();
boolean hasDateTo = params.hasDateTo();
String queryPrefix = "select T from TaskData T where ";
Query query = getQuery(session, params, taskStatuses, hasUser, hasTag, hasDateFrom, hasDateTo, params.getSortParams(), queryPrefix);
query.setMaxResults(params.getLimit());
query.setFirstResult(params.getOffset());
return query.list();
}
use of org.ow2.proactive.scheduler.common.task.TaskStatus in project scheduling by ow2-proactive.
the class SchedulerStateRecoverHelperTest method testRecoverWithMixedJobs.
@Test
public void testRecoverWithMixedJobs() throws Exception {
ImmutableList<JobStatus> jobStatuses = ImmutableList.of(JobStatus.CANCELED, JobStatus.FAILED, JobStatus.FINISHED, JobStatus.KILLED, JobStatus.PAUSED, JobStatus.PENDING, JobStatus.RUNNING, JobStatus.STALLED);
ImmutableList<TaskStatus> taskStatuses = ImmutableList.of(TaskStatus.ABORTED, TaskStatus.FAILED, TaskStatus.FINISHED, TaskStatus.ABORTED, TaskStatus.PAUSED, TaskStatus.PENDING, TaskStatus.RUNNING, TaskStatus.SUBMITTED);
List<InternalJob> jobs = new ArrayList<>(jobStatuses.size());
for (int i = 0; i < jobStatuses.size(); i++) {
InternalJob job = createJob(jobStatuses.get(i));
jobs.add(job);
changeTasksState(job, taskStatuses.get(i));
}
RecoveredSchedulerState recoveredState = new Scenario(jobs).execute();
assertThat(recoveredState.getFinishedJobs()).hasSize(4);
assertThat(recoveredState.getPendingJobs()).hasSize(2);
assertThat(recoveredState.getRunningJobs()).hasSize(2);
}
use of org.ow2.proactive.scheduler.common.task.TaskStatus in project scheduling by ow2-proactive.
the class SchedulerStateRecoverHelperTest method testRecoverWithStalledJobOnly.
@Test
public void testRecoverWithStalledJobOnly() throws Exception {
InternalJob job = createJob(JobStatus.STALLED);
changeTasksState(job, TaskStatus.PENDING);
ImmutableMap<String, TaskStatus> taskStatus = ImmutableMap.of("Ta", TaskStatus.FINISHED, "Tb", TaskStatus.SKIPPED, "Tc", TaskStatus.PENDING);
changeTasksState(job, taskStatus);
RecoveredSchedulerState recoveredState = new Scenario(job).execute();
job = recoveredState.getRunningJobs().get(0);
assertThat(job.getStatus()).isEqualTo(JobStatus.STALLED);
assertTasksStatus(job, taskStatus);
}
use of org.ow2.proactive.scheduler.common.task.TaskStatus in project scheduling by ow2-proactive.
the class SchedulerStateRecoverHelperTest method changeTasksState.
private void changeTasksState(InternalJob job, Map<String, TaskStatus> newStatuses) {
int nbPending = 0;
int nbRunning = 0;
int nbFinished = 0;
for (InternalTask internalTask : job.getITasks()) {
TaskStatus newStatus = newStatuses.get(internalTask.getName());
if (newStatus != null) {
internalTask.setStatus(newStatus);
}
switch(internalTask.getStatus()) {
case PENDING:
nbPending++;
break;
case RUNNING:
nbRunning++;
break;
case FINISHED:
nbFinished++;
break;
}
}
updateJobCounters(job, nbPending, nbRunning, nbFinished);
}
use of org.ow2.proactive.scheduler.common.task.TaskStatus 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);
}
Aggregations