Search in sources :

Example 1 with ExecuterInformation

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

the class InternalForkedScriptTask method createLauncher.

/**
 * {@inheritDoc}
 */
@Override
public TaskLauncher createLauncher(Node node) throws ActiveObjectCreationException, NodeException {
    logger.info(getTaskInfo().getTaskId(), "creating forked task launcher");
    TaskLauncher launcher = (TaskLauncher) PAActiveObject.newActive(TaskLauncher.class.getName(), new Object[] { getDefaultTaskLauncherInitializer(), new ProActiveForkedTaskLauncherFactory() }, node);
    // wait until the task launcher is active
    launcher.isActivated();
    setExecuterInformation(new ExecuterInformation(launcher, node));
    return launcher;
}
Also used : TaskLauncher(org.ow2.proactive.scheduler.task.TaskLauncher) PAActiveObject(org.objectweb.proactive.api.PAActiveObject) ProActiveForkedTaskLauncherFactory(org.ow2.proactive.scheduler.task.ProActiveForkedTaskLauncherFactory)

Example 2 with ExecuterInformation

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

the class InternalScriptTask method createLauncher.

/**
 * {@inheritDoc}
 */
@Override
public TaskLauncher createLauncher(Node node) throws ActiveObjectCreationException, NodeException {
    logger.info(getTaskInfo().getTaskId(), "creating non forked task launcher");
    TaskLauncher launcher = (TaskLauncher) PAActiveObject.newActive(TaskLauncher.class.getName(), new Object[] { getDefaultTaskLauncherInitializer(), new ProActiveNonForkedTaskLauncherFactory() }, node);
    // wait until the task launcher is active
    launcher.isActivated();
    setExecuterInformation(new ExecuterInformation(launcher, node));
    return launcher;
}
Also used : TaskLauncher(org.ow2.proactive.scheduler.task.TaskLauncher) PAActiveObject(org.objectweb.proactive.api.PAActiveObject) ProActiveNonForkedTaskLauncherFactory(org.ow2.proactive.scheduler.task.ProActiveNonForkedTaskLauncherFactory)

Example 3 with ExecuterInformation

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

the class LiveJobsTest method testFinishInErrorTask.

@Test(timeout = 60000)
public void testFinishInErrorTask() throws UnknownTaskException, UnknownJobException {
    InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CONTINUE_JOB_EXECUTION, "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");
    internalTask.setStatus(TaskStatus.IN_ERROR);
    Node node = Mockito.mock(Node.class);
    Mockito.when(node.getVMInformation()).thenAnswer(new Answer<VMInformation>() {

        @Override
        public VMInformation answer(InvocationOnMock invocation) throws Throwable {
            return Mockito.mock(VMInformation.class);
        }
    });
    Mockito.when(node.getNodeInformation()).thenAnswer(new Answer<NodeInformation>() {

        @Override
        public NodeInformation answer(InvocationOnMock invocation) throws Throwable {
            return Mockito.mock(NodeInformation.class);
        }
    });
    TaskLauncher taskLauncher = Mockito.mock(TaskLauncher.class);
    internalTask.setExecuterInformation(new ExecuterInformation(taskLauncher, node));
    tasksList.add(internalTask);
    job.setTasks(tasksList);
    liveJobs.jobSubmitted(job);
    liveJobs.finishInErrorTask(job.getId(), "task-name");
    assertThat(internalTask.getStatus(), is(TaskStatus.FINISHED));
}
Also used : ExecuterInformation(org.ow2.proactive.scheduler.task.internal.ExecuterInformation) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) NodeInformation(org.objectweb.proactive.core.node.NodeInformation) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) VMInformation(org.objectweb.proactive.core.runtime.VMInformation) TaskLauncher(org.ow2.proactive.scheduler.task.TaskLauncher) Node(org.objectweb.proactive.core.node.Node) ArrayList(java.util.ArrayList) InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) InvocationOnMock(org.mockito.invocation.InvocationOnMock) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) InternalTaskFlowJob(org.ow2.proactive.scheduler.job.InternalTaskFlowJob) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 4 with ExecuterInformation

use of org.ow2.proactive.scheduler.task.internal.ExecuterInformation 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 5 with ExecuterInformation

use of org.ow2.proactive.scheduler.task.internal.ExecuterInformation 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)5 ExecuterInformation (org.ow2.proactive.scheduler.task.internal.ExecuterInformation)4 PAActiveObject (org.objectweb.proactive.api.PAActiveObject)2 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 ProActiveRuntimeException (org.objectweb.proactive.core.ProActiveRuntimeException)1 Node (org.objectweb.proactive.core.node.Node)1 NodeInformation (org.objectweb.proactive.core.node.NodeInformation)1 VMInformation (org.objectweb.proactive.core.runtime.VMInformation)1 JobId (org.ow2.proactive.scheduler.common.job.JobId)1 EligibleTaskDescriptorImpl (org.ow2.proactive.scheduler.descriptor.EligibleTaskDescriptorImpl)1 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)1 InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)1 JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)1 ProActiveForkedTaskLauncherFactory (org.ow2.proactive.scheduler.task.ProActiveForkedTaskLauncherFactory)1 ProActiveNonForkedTaskLauncherFactory (org.ow2.proactive.scheduler.task.ProActiveNonForkedTaskLauncherFactory)1 InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)1