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;
}
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;
}
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));
}
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);
}
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);
}
Aggregations