use of org.objectweb.proactive.core.runtime.ProActiveRuntime in project scheduling by ow2-proactive.
the class RMNodeHelper method createNode.
private static Node createNode(String name, String hostname, String nodeUrl, String proActiveRuntimeUrl) {
VMInformation vmInformation = Mockito.mock(VMInformation.class);
when(vmInformation.getHostName()).thenReturn(hostname);
NodeInformation nodeInformation = Mockito.mock(NodeInformation.class);
when(nodeInformation.getName()).thenReturn(name);
when(nodeInformation.getURL()).thenReturn(nodeUrl);
when(nodeInformation.getVMInformation()).thenReturn(vmInformation);
ProActiveRuntime proActiveRuntime = Mockito.mock(ProActiveRuntime.class);
when(proActiveRuntime.getURL()).thenReturn(proActiveRuntimeUrl);
Node node = Mockito.mock(Node.class);
when(node.getNodeInformation()).thenReturn(nodeInformation);
when(node.getProActiveRuntime()).thenReturn(proActiveRuntime);
return node;
}
use of org.objectweb.proactive.core.runtime.ProActiveRuntime in project scheduling by ow2-proactive.
the class InProcessTaskExecutorTest method mockedNodeSet.
private NodeSet mockedNodeSet() {
NodeSet nodes = new NodeSet();
ProActiveRuntime proActiveRuntime = mock(ProActiveRuntime.class);
VMInformation vmInformation = mock(VMInformation.class);
when(vmInformation.getHostName()).thenReturn("dummyhost");
when(proActiveRuntime.getVMInformation()).thenReturn(vmInformation);
nodes.add(new NodeImpl(proActiveRuntime, "dummyhost"));
return nodes;
}
use of org.objectweb.proactive.core.runtime.ProActiveRuntime in project scheduling by ow2-proactive.
the class RMTHelper method killNode.
/**
* Kills the node with specified url
* @param url of the node
* @throws NodeException if node cannot be looked up
*/
public static void killNode(String url) throws NodeException {
Node node = NodeFactory.getNode(url);
try {
ProActiveRuntime rt = node.getProActiveRuntime();
rt.killNode(node.getNodeInformation().getName());
} catch (Exception ignored) {
}
}
use of org.objectweb.proactive.core.runtime.ProActiveRuntime in project scheduling by ow2-proactive.
the class RestFuncTHelper method stopRestfulSchedulerWebapp.
public static void stopRestfulSchedulerWebapp() {
// Kill all rm nodes
try {
Set<String> urls = rm.listAliveNodeUrls();
for (String nodeUrl : urls) {
try {
ProActiveRuntime runtime = (ProActiveRuntime) PARemoteObject.lookup(URI.create(nodeUrl));
runtime.killRT(false);
} catch (Throwable noNeed) {
}
}
rm.shutdown(true);
} catch (Throwable noNeed) {
}
System.out.println("Shutting down the scheduler.");
try {
scheduler.shutdown();
} catch (Throwable ignore) {
}
// Destroy the scheduler process
System.out.println("Shutting down scheduler process.");
if (schedProcess != null) {
try {
RestFuncTUtils.destroy(schedProcess);
} catch (Throwable error) {
System.err.println("An error occurred while shutting down scheduler process:");
error.printStackTrace();
} finally {
try {
RestFuncTUtils.cleanupActiveObjectRegistry(SchedulerConstants.SCHEDULER_DEFAULT_NAME);
} catch (Throwable error) {
}
}
}
}
Aggregations