Search in sources :

Example 16 with EligibleTaskDescriptorImpl

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());
            }
        }
    }
}
Also used : TaskDescriptor(org.ow2.proactive.scheduler.common.TaskDescriptor) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask)

Example 17 with EligibleTaskDescriptorImpl

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);
}
Also used : ExecuterInformation(org.ow2.proactive.scheduler.task.internal.ExecuterInformation) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) TaskLauncher(org.ow2.proactive.scheduler.task.TaskLauncher) EligibleTaskDescriptorImpl(org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptorImpl)

Example 18 with EligibleTaskDescriptorImpl

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;
}
Also used : EligibleTaskDescriptor(org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor) JobId(org.ow2.proactive.scheduler.common.job.JobId)

Aggregations

EligibleTaskDescriptorImpl (org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptorImpl)9 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)9 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)8 TaskDescriptor (org.ow2.proactive.scheduler.common.TaskDescriptor)6 EligibleTaskDescriptor (org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptor)5 HashMap (java.util.HashMap)4 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)2 LinkedList (java.util.LinkedList)2 Entry (java.util.Map.Entry)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Test (org.junit.Test)2 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)2 IOException (java.io.IOException)1 ActiveObjectCreationException (org.objectweb.proactive.ActiveObjectCreationException)1 Node (org.objectweb.proactive.core.node.Node)1 TopologyDisabledException (org.ow2.proactive.resourcemanager.frontend.topology.TopologyDisabledException)1 JobId (org.ow2.proactive.scheduler.common.job.JobId)1 TaskInfo (org.ow2.proactive.scheduler.common.task.TaskInfo)1 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)1