Search in sources :

Example 16 with TaskLauncher

use of org.ow2.proactive.scheduler.task.TaskLauncher in project scheduling by ow2-proactive.

the class ExecuterInformationData method toExecuterInformation.

/**
 * Rebuild an executer information from the data. A stub to the task
 * launcher is attempted to be retrieved.
 * @param loadFullState whether it is important to have a task launcher
 *                      stub in the end (it is important if the task is
 *                      running)
 */
public ExecuterInformation toExecuterInformation(boolean loadFullState) {
    TaskLauncher taskLauncher = null;
    if (taskLauncherNodeUrl != null) {
        try {
            taskLauncher = PAActiveObject.lookupActive(TaskLauncher.class, taskLauncherNodeUrl);
            logger.info("Retrieve task launcher " + taskLauncherNodeUrl + " successfully for task " + taskId);
        } catch (Exception e) {
            if (loadFullState) {
                logger.warn("Task launcher " + taskLauncherNodeUrl + " of task " + taskId + " cannot be looked up, try to rebind it");
                taskLauncher = getReboundTaskLauncherIfStillExist();
            }
        }
    }
    return new ExecuterInformation(taskLauncher, nodes, nodeName, hostName);
}
Also used : ExecuterInformation(org.ow2.proactive.scheduler.task.internal.ExecuterInformation) TaskLauncher(org.ow2.proactive.scheduler.task.TaskLauncher) ProActiveRuntimeException(org.objectweb.proactive.core.ProActiveRuntimeException)

Example 17 with TaskLauncher

use of org.ow2.proactive.scheduler.task.TaskLauncher 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)

Aggregations

TaskLauncher (org.ow2.proactive.scheduler.task.TaskLauncher)9 Test (org.junit.Test)7 ScriptExecutableContainer (org.ow2.proactive.scheduler.task.containers.ScriptExecutableContainer)6 SimpleScript (org.ow2.proactive.scripting.SimpleScript)6 TaskScript (org.ow2.proactive.scripting.TaskScript)6 Semaphore (java.util.concurrent.Semaphore)5 Repeat (org.ow2.proactive.utils.Repeat)5 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)4 PAActiveObject (org.objectweb.proactive.api.PAActiveObject)3 ExecuterInformation (org.ow2.proactive.scheduler.task.internal.ExecuterInformation)3 Node (org.objectweb.proactive.core.node.Node)2 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)2 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)2 InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)2 NodeSet (org.ow2.proactive.utils.NodeSet)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Appender (org.apache.log4j.Appender)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 ActiveObjectCreationException (org.objectweb.proactive.ActiveObjectCreationException)1