use of org.ow2.proactive.scheduler.descriptor.JobDescriptorImpl in project scheduling by ow2-proactive.
the class TaskResultCreatorTest method getMockedJobDescriptorWithRunningTask.
private JobDescriptorImpl getMockedJobDescriptorWithRunningTask() {
JobDescriptorImpl mockedJobDescriptor = this.getMockedJobDescriptor();
Map fakeMap = this.mockedPausedOrRunningTaskMap();
when(mockedJobDescriptor.getRunningTasks()).thenReturn(fakeMap);
return mockedJobDescriptor;
}
use of org.ow2.proactive.scheduler.descriptor.JobDescriptorImpl in project scheduling by ow2-proactive.
the class TaskResultCreatorTest method getMockedInternalJob.
private InternalJob getMockedInternalJob(JobDescriptorImpl mockedJobDescriptor) {
InternalJob mockedInternalJob = mock(InternalJob.class);
when(mockedInternalJob.getJobDescriptor()).thenReturn(mockedJobDescriptor);
return mockedInternalJob;
}
use of org.ow2.proactive.scheduler.descriptor.JobDescriptorImpl 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.descriptor.JobDescriptorImpl in project scheduling by ow2-proactive.
the class DefaultPolicyTest method job_with_same_priorities.
@Test
public void job_with_same_priorities() throws Exception {
JobDescriptorImpl job1 = createSingleTaskJob();
JobDescriptorImpl job2 = createSingleTaskJob();
JobDescriptorImpl job3 = createSingleTaskJob();
List<JobDescriptor> jobs = submitJobs(job1, job3, job2);
LinkedList<EligibleTaskDescriptor> orderedTasks = new DefaultPolicy().getOrderedTasks(jobs);
assertEquals(job1.getJobId(), orderedTasks.get(0).getJobId());
assertEquals(job2.getJobId(), orderedTasks.get(1).getJobId());
assertEquals(job3.getJobId(), orderedTasks.get(2).getJobId());
}
use of org.ow2.proactive.scheduler.descriptor.JobDescriptorImpl in project scheduling by ow2-proactive.
the class SchedulingServiceTest7 method testTaskReplication.
@Test
public void testTaskReplication() throws Exception {
service.submitJob(createJob(createTestJob()));
listener.assertEvents(SchedulerEvent.JOB_SUBMITTED);
Map<JobId, JobDescriptor> jobsMap;
JobDescriptor jobDesc;
jobsMap = service.lockJobsToSchedule();
assertEquals(1, jobsMap.size());
jobDesc = jobsMap.values().iterator().next();
Assert.assertEquals(1, jobDesc.getEligibleTasks().size());
for (TaskDescriptor taskDesc : jobDesc.getEligibleTasks()) {
taskStarted(jobDesc, (EligibleTaskDescriptor) taskDesc);
}
service.unlockJobsToSchedule(jobsMap.values());
listener.assertEvents(SchedulerEvent.JOB_PENDING_TO_RUNNING, SchedulerEvent.JOB_UPDATED, SchedulerEvent.TASK_PENDING_TO_RUNNING);
TaskId taskId;
taskId = ((JobDescriptorImpl) jobDesc).getInternal().getTask("Main task").getId();
TaskResultImpl result = new TaskResultImpl(taskId, "OK", null, 0);
FlowAction action = new FlowAction(FlowActionType.REPLICATE);
action.setDupNumber(3);
result.setAction(action);
service.taskTerminatedWithResult(taskId, result);
listener.assertEvents(SchedulerEvent.TASK_REPLICATED, SchedulerEvent.TASK_SKIPPED, SchedulerEvent.JOB_UPDATED, SchedulerEvent.TASK_RUNNING_TO_FINISHED);
jobsMap = service.lockJobsToSchedule();
assertEquals(1, jobsMap.size());
jobDesc = jobsMap.values().iterator().next();
Assert.assertEquals(3, jobDesc.getEligibleTasks().size());
for (TaskDescriptor taskDesc : jobDesc.getEligibleTasks()) {
taskStarted(jobDesc, (EligibleTaskDescriptor) taskDesc);
}
service.unlockJobsToSchedule(jobsMap.values());
listener.assertEvents(SchedulerEvent.TASK_PENDING_TO_RUNNING, SchedulerEvent.TASK_PENDING_TO_RUNNING, SchedulerEvent.TASK_PENDING_TO_RUNNING);
}
Aggregations