Search in sources :

Example 1 with ProActiveRuntime

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;
}
Also used : NodeInformation(org.objectweb.proactive.core.node.NodeInformation) VMInformation(org.objectweb.proactive.core.runtime.VMInformation) Node(org.objectweb.proactive.core.node.Node) ProActiveRuntime(org.objectweb.proactive.core.runtime.ProActiveRuntime)

Example 2 with ProActiveRuntime

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;
}
Also used : NodeSet(org.ow2.proactive.utils.NodeSet) NodeImpl(org.objectweb.proactive.core.node.NodeImpl) VMInformation(org.objectweb.proactive.core.runtime.VMInformation) ProActiveRuntime(org.objectweb.proactive.core.runtime.ProActiveRuntime)

Example 3 with ProActiveRuntime

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) {
    }
}
Also used : StartNode(org.objectweb.proactive.core.node.StartNode) Node(org.objectweb.proactive.core.node.Node) ProActiveRuntime(org.objectweb.proactive.core.runtime.ProActiveRuntime) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) ProActiveTimeoutException(org.objectweb.proactive.core.ProActiveTimeoutException) NodeException(org.objectweb.proactive.core.node.NodeException) AlreadyBoundException(java.rmi.AlreadyBoundException)

Example 4 with ProActiveRuntime

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) {
            }
        }
    }
}
Also used : ProActiveRuntime(org.objectweb.proactive.core.runtime.ProActiveRuntime)

Aggregations

ProActiveRuntime (org.objectweb.proactive.core.runtime.ProActiveRuntime)4 Node (org.objectweb.proactive.core.node.Node)2 VMInformation (org.objectweb.proactive.core.runtime.VMInformation)2 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 AlreadyBoundException (java.rmi.AlreadyBoundException)1 ExecutionException (java.util.concurrent.ExecutionException)1 ProActiveTimeoutException (org.objectweb.proactive.core.ProActiveTimeoutException)1 NodeException (org.objectweb.proactive.core.node.NodeException)1 NodeImpl (org.objectweb.proactive.core.node.NodeImpl)1 NodeInformation (org.objectweb.proactive.core.node.NodeInformation)1 StartNode (org.objectweb.proactive.core.node.StartNode)1 NodeSet (org.ow2.proactive.utils.NodeSet)1