use of org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptorImpl in project scheduling by ow2-proactive.
the class JobDescriptorImpl method makeTree.
/**
* Make a dependences tree of the job's tasks according to the dependence list
* stored in taskDescriptor.
* This list represents the ordered TaskDescriptor list of its parent tasks.
*/
private void makeTree(InternalJob job) {
// create task descriptor list
for (InternalTask td : job.getITasks()) {
// if this task is a first task, put it in eligible tasks list
EligibleTaskDescriptor lt = new EligibleTaskDescriptorImpl(td);
if (isEntryPoint(td, job.getITasks())) {
eligibleTasks.put(td.getId(), lt);
}
if (td.getJoinedBranches() != null || td.getIfBranch() != null) {
branchTasks.put(td.getId(), lt);
}
allTasksWithTheirChildren.put(td, lt);
}
// now for each taskDescriptor, set the parents and children list
for (InternalTask td : job.getITasks()) {
if (td.getDependences() != null) {
TaskDescriptor taskDescriptor = allTasksWithTheirChildren.get(td);
for (InternalTask depends : td.getIDependences()) {
((EligibleTaskDescriptorImpl) taskDescriptor).addParent(allTasksWithTheirChildren.get(depends));
}
for (TaskDescriptor lt : taskDescriptor.getParents()) {
((EligibleTaskDescriptorImpl) lt).addChild(taskDescriptor);
hasChildren.add(lt.getTaskId());
}
}
}
}
use of org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptorImpl in project scheduling by ow2-proactive.
the class BaseServiceTest method taskStarted.
void taskStarted(JobDescriptor jobDesc, EligibleTaskDescriptor taskDesc) throws Exception {
InternalTask task = ((EligibleTaskDescriptorImpl) taskDesc).getInternal();
TaskLauncher launcher = Mockito.mock(TaskLauncher.class);
task.setExecuterInformation(new ExecuterInformation(launcher, NodeFactory.getDefaultNode()));
service.taskStarted(((JobDescriptorImpl) jobDesc).getInternal(), task, launcher);
}
use of org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptorImpl in project scheduling by ow2-proactive.
the class LiveJobs method simulateJobStart.
TerminationData simulateJobStart(List<EligibleTaskDescriptor> tasksToSchedule, String errorMsg) {
TerminationData terminationData = TerminationData.newTerminationData();
for (EligibleTaskDescriptor eltd : tasksToSchedule) {
JobId jobId = eltd.getJobId();
if (!terminationData.jobTerminated(jobId)) {
JobData jobData = lockJob(jobId);
if (jobData != null) {
try {
if (jobData.job.getStartTime() < 0) {
jobData.job.start();
updateJobInSchedulerState(jobData.job, SchedulerEvent.JOB_PENDING_TO_RUNNING);
jlogger.info(jobId, "started");
}
endJob(jobData, terminationData, ((EligibleTaskDescriptorImpl) eltd).getInternal(), null, errorMsg, JobStatus.CANCELED);
} finally {
jobData.unlock();
}
}
}
}
return terminationData;
}
Aggregations