use of org.objectweb.proactive.extensions.dataspaces.core.naming.NamingService in project scheduling by ow2-proactive.
the class TaskLauncherTest method scratchDirDeletedAfterTaskCompleted.
@Test
public void scratchDirDeletedAfterTaskCompleted() throws Throwable {
ScriptExecutableContainer executableContainer = new ScriptExecutableContainer(new TaskScript(new SimpleScript("print('hello'); result='hello'", "groovy")));
TaskLauncherInitializer initializer = new TaskLauncherInitializer();
initializer.setTaskId(TaskIdImpl.createTaskId(JobIdImpl.makeJobId("1000"), "job", 1000L));
final TaskDataspaces dataspacesMock = mock(TaskDataspaces.class);
when(dataspacesMock.getScratchFolder()).thenReturn(tmpFolder.newFolder());
runTaskLauncher(createLauncherWithInjectedMocks(initializer, new TestTaskLauncherFactory() {
@Override
public TaskDataspaces createTaskDataspaces(TaskId taskId, NamingService namingService, boolean isRunAsUser) {
return dataspacesMock;
}
}), executableContainer);
verify(dataspacesMock).close();
}
use of org.objectweb.proactive.extensions.dataspaces.core.naming.NamingService in project scheduling by ow2-proactive.
the class SchedulerDataspace method endActivity.
@Override
public void endActivity(Body body) {
taskDataSpaceApplication.terminateDataSpaceApplication();
Set<String> registeredApplications = dataSpaceServiceStarter.getNamingService().getRegisteredApplications();
NamingService namingService = dataSpaceServiceStarter.getNamingService();
for (String registeredApplication : registeredApplications) {
try {
namingService.unregisterApplication(registeredApplication);
} catch (WrongApplicationIdException e) {
throw new IllegalStateException(e);
}
}
dataSpaceServiceStarter.terminateNamingService();
dataSpaceServiceStarter.clearSpaceConfigurations();
}
use of org.objectweb.proactive.extensions.dataspaces.core.naming.NamingService in project scheduling by ow2-proactive.
the class TaskLauncherTest method taskLogsAreNotCopiedToUserSpace_PreciousLogsDisabled.
@Test
public void taskLogsAreNotCopiedToUserSpace_PreciousLogsDisabled() throws Exception {
ScriptExecutableContainer executableContainer = new ScriptExecutableContainer(new TaskScript(new SimpleScript("print('hello'); result='hello'", "groovy")));
TaskLauncherInitializer initializer = new TaskLauncherInitializer();
initializer.setPreciousLogs(false);
initializer.setTaskId(TaskIdImpl.createTaskId(JobIdImpl.makeJobId("1000"), "job", 1000L));
final TaskDataspaces dataspacesMock = mock(TaskDataspaces.class);
when(dataspacesMock.getScratchFolder()).thenReturn(tmpFolder.newFolder());
runTaskLauncher(createLauncherWithInjectedMocks(initializer, new TestTaskLauncherFactory() {
@Override
public TaskDataspaces createTaskDataspaces(TaskId taskId, NamingService namingService, boolean isRunAsUser) {
return dataspacesMock;
}
}), executableContainer);
verify(dataspacesMock, times(1)).copyScratchDataToOutput(Matchers.<List<OutputSelector>>any());
}
use of org.objectweb.proactive.extensions.dataspaces.core.naming.NamingService in project scheduling by ow2-proactive.
the class TaskLauncherTest method taskLogsAreCopiedToUserSpace.
@Test
public void taskLogsAreCopiedToUserSpace() throws Exception {
ScriptExecutableContainer executableContainer = new ScriptExecutableContainer(new TaskScript(new SimpleScript("print('hello'); result='hello'", "groovy")));
TaskLauncherInitializer initializer = new TaskLauncherInitializer();
initializer.setPreciousLogs(true);
initializer.setTaskId(TaskIdImpl.createTaskId(JobIdImpl.makeJobId("1000"), "job", 1000L));
final TaskDataspaces dataspacesMock = mock(TaskDataspaces.class);
when(dataspacesMock.getScratchFolder()).thenReturn(tmpFolder.newFolder());
runTaskLauncher(createLauncherWithInjectedMocks(initializer, new TestTaskLauncherFactory() {
@Override
public TaskDataspaces createTaskDataspaces(TaskId taskId, NamingService namingService, boolean isRunAsUser) {
return dataspacesMock;
}
}), executableContainer);
verify(dataspacesMock, times(2)).copyScratchDataToOutput(Matchers.<List<OutputSelector>>any());
}
use of org.objectweb.proactive.extensions.dataspaces.core.naming.NamingService in project scheduling by ow2-proactive.
the class NodeDataspace method init.
public void init(TaskId taskId, String namingServiceUrl) throws Exception {
dataSpaceNodeConfigurationAgent = (DataSpaceNodeConfigurationAgent) PAActiveObject.newActive(DataSpaceNodeConfigurationAgent.class.getName(), null, PAActiveObject.getNode());
if (!dataSpaceNodeConfigurationAgent.configureNode()) {
throw new IllegalStateException("Could not configure node for dataspaces");
}
NamingService namingServiceStub = NamingService.createNamingServiceStub(namingServiceUrl);
taskProActiveDataspaces = new TaskProActiveDataspaces(taskId, namingServiceStub, false);
System.out.println("Node scratch folder is " + getScratchFolder());
}
Aggregations