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