use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class DefaultPolicyTest method createSingleTaskJob.
private JobDescriptorImpl createSingleTaskJob(JobPriority jobPriority) {
InternalTaskFlowJob taskFlowJob = new InternalTaskFlowJob("test", jobPriority, OnTaskError.CANCEL_JOB, "");
taskFlowJob.setId(JobIdImpl.makeJobId(Integer.toString(jobId++)));
ArrayList<InternalTask> tasks = new ArrayList<>();
tasks.add(new InternalScriptTask(taskFlowJob));
taskFlowJob.addTasks(tasks);
return new JobDescriptorImpl(taskFlowJob);
}
use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class InternalTaskParentFinderTest method generateInternalTask.
private InternalTask generateInternalTask(long id, TaskStatus taskStatus) {
InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
InternalTask internalTask = new InternalScriptTask(job);
internalTask.setId(TaskIdImpl.createTaskId(new JobIdImpl(666L, "JobName"), "readableName", id));
internalTask.setStatus(taskStatus);
return internalTask;
}
use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class SchedulingServiceTest9 method testRestartOnNodeFailureAndJobCancel.
@Test
public void testRestartOnNodeFailureAndJobCancel() throws Exception {
service.submitJob(createJob(createTestJob()));
listener.assertEvents(SchedulerEvent.JOB_SUBMITTED);
JobDescriptor jobDesc;
jobDesc = startTask(2);
listener.assertEvents(SchedulerEvent.JOB_PENDING_TO_RUNNING, SchedulerEvent.JOB_UPDATED, SchedulerEvent.TASK_PENDING_TO_RUNNING, SchedulerEvent.TASK_PENDING_TO_RUNNING);
InternalTask task = ((JobDescriptorImpl) jobDesc).getInternal().getTask("javaTask1");
service.restartTaskOnNodeFailure(task);
listener.assertEvents(SchedulerEvent.TASK_WAITING_FOR_RESTART);
infrastructure.assertRequests(1);
startTask(1);
service.restartTaskOnNodeFailure(task);
listener.assertEvents(SchedulerEvent.TASK_PENDING_TO_RUNNING, SchedulerEvent.TASK_RUNNING_TO_FINISHED, SchedulerEvent.TASK_RUNNING_TO_FINISHED, SchedulerEvent.JOB_RUNNING_TO_FINISHED, SchedulerEvent.JOB_UPDATED);
infrastructure.assertRequests(2);
}
use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class LiveJobsTest method testRestartTaskOnNodeRunning0ExecutionsLeft.
@Test(timeout = 60000)
public void testRestartTaskOnNodeRunning0ExecutionsLeft() throws UnknownJobException, UnknownTaskException {
PASchedulerProperties.NUMBER_OF_EXECUTION_ON_FAILURE.updateProperty("0");
InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
JobId id = new JobIdImpl(666L, "test-name");
job.setId(id);
List<InternalTask> tasksList = new ArrayList<>();
InternalScriptTask internalTask = new InternalScriptTask(job);
internalTask.setName("task-name");
internalTask.setStatus(TaskStatus.RUNNING);
internalTask.setMaxNumberOfExecution(5);
internalTask.setExecuterInformation(Mockito.mock(ExecuterInformation.class));
tasksList.add(internalTask);
job.setTasks(tasksList);
liveJobs.jobSubmitted(job);
liveJobs.lockJobsToSchedule();
liveJobs.taskStarted(job, job.getTask("task-name"), null);
assertThat(internalTask.getMaxNumberOfExecutionOnFailure(), is(0));
assertThat(internalTask.getTaskInfo().getNumberOfExecutionOnFailureLeft(), is(0));
liveJobs.restartTaskOnNodeFailure(internalTask);
internalTask.setStatus(TaskStatus.RUNNING);
Mockito.verify(dbManager, Mockito.times(0)).taskRestarted(job, internalTask, null);
}
use of org.ow2.proactive.scheduler.task.internal.InternalTask in project scheduling by ow2-proactive.
the class LiveJobsTest method testLockJobsToSchedule.
@Test(timeout = 60000)
public void testLockJobsToSchedule() throws UnknownJobException, UnknownTaskException {
InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
JobId id = new JobIdImpl(666L, "test-name");
job.setId(id);
List<InternalTask> tasksList = new ArrayList<>();
InternalTask internalTask = new InternalScriptTask(job);
internalTask.setName("task-name");
tasksList.add(internalTask);
job.setTasks(tasksList);
liveJobs.jobSubmitted(job);
liveJobs.pauseJob(id);
assertThat(liveJobs.lockJobsToSchedule().size(), is(1));
}
Aggregations