Search in sources :

Example 16 with ResourceManager

use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.

the class SelectionTest method action.

@Test
public void action() throws Exception {
    String currentHost = System.getenv("HOSTNAME");
    // checking if properties distantHost and neighborHost are defined
    String distantHost = System.getProperty("distantHost");
    String neighborHost = System.getProperty("neighborHost");
    if (distantHost != null && !distantHost.equals("${distantHost}") && neighborHost != null && !neighborHost.equals("${neighborHost}")) {
        String rmHome = System.getProperty("pa.rm.home");
        String rmCredPath = rmHome + "/config/authentication/rm.cred";
        String javaExec = System.getenv("JAVA_HOME") + "/bin/java";
        // properties are defined, trying to deploy nodes to these hosts
        BooleanWrapper result = rmHelper.getResourceManager().createNodeSource("remote", SSHInfrastructure.class.getName(), new Object[] { // ssh options
        "", // java executable path
        javaExec, // rmHelper distrib path
        rmHome, // node lookup timeout
        "30000", // attempts
        "2", // os
        "Linux", // java options
        "", // rmHelper credential
        FileToBytesConverter.convertFileToByteArray(new File(rmCredPath)), (distantHost + " 2\n" + neighborHost).getBytes() }, StaticPolicy.class.getName(), null, NODES_NOT_RECOVERABLE);
        if (result.getBooleanValue()) {
            rmHelper.waitForAnyNodeEvent(RMEventType.NODE_ADDED);
            rmHelper.waitForAnyNodeEvent(RMEventType.NODE_ADDED);
            rmHelper.waitForAnyNodeEvent(RMEventType.NODE_ADDED);
            // wait for the nodes to be in free state
            rmHelper.waitForAnyNodeEvent(RMEventType.NODE_STATE_CHANGED);
            rmHelper.waitForAnyNodeEvent(RMEventType.NODE_STATE_CHANGED);
            rmHelper.waitForAnyNodeEvent(RMEventType.NODE_STATE_CHANGED);
        }
    // we are good - all remote nodes registered
    } else {
        // no parameters provided
        RMTHelper.log("Nothing to do. Set up distantHost & neighborHost parameters.");
        return;
    }
    // creating the selection script object
    SelectionScript script = new SelectionScript(new File(vmPropSelectionScriptpath), new String[] { this.vmPropKey1, this.vmPropValue1 }, true);
    List<SelectionScript> scriptList = new LinkedList<>();
    scriptList.add(script);
    ResourceManager resourceManager = rmHelper.getResourceManager();
    String node1 = "node1";
    // a node with the VM properties
    HashMap<String, String> vmProperties = new HashMap<>();
    vmProperties.put(this.vmPropKey1, this.vmPropValue1);
    testNode = rmHelper.createNode(node1, vmProperties);
    String node1URL = testNode.getNode().getNodeInformation().getURL();
    resourceManager.addNode(node1URL, NodeSource.DEFAULT);
    // wait node adding event
    rmHelper.waitForNodeEvent(RMEventType.NODE_ADDED, node1URL);
    // wait for the nodes to be in free state
    rmHelper.waitForAnyNodeEvent(RMEventType.NODE_STATE_CHANGED);
    // so now we have 9 node in total
    // 6 local nodes (5 default, 1 marked with property)
    // 2 nodes on distant host
    // 1 node on neighbor host
    Assert.assertEquals(9, resourceManager.getState().getFreeNodesNumber());
    // checking TopologyDescriptor.ARBITRARY
    NodeSet ns = resourceManager.getAtMostNodes(1, TopologyDescriptor.ARBITRARY, null, null);
    Assert.assertEquals(1, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(8, TopologyDescriptor.ARBITRARY, null, null);
    Assert.assertEquals(8, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(100, TopologyDescriptor.ARBITRARY, null, null);
    Assert.assertEquals(9, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(100, TopologyDescriptor.ARBITRARY, scriptList, null);
    Assert.assertEquals(1, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    // checking TopologyDescriptor.BEST_PROXIMITY
    ns = resourceManager.getAtMostNodes(1, TopologyDescriptor.BEST_PROXIMITY, null, null);
    Assert.assertEquals(1, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(9, TopologyDescriptor.BEST_PROXIMITY, null, null);
    Assert.assertEquals(9, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(100, TopologyDescriptor.BEST_PROXIMITY, null, null);
    Assert.assertEquals(9, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    // Node pivotNode = null;
    ns = resourceManager.getAtMostNodes(6, TopologyDescriptor.BEST_PROXIMITY, null, null);
    Assert.assertEquals(6, ns.size());
    for (Node node : ns) {
        // pivotNode = node;
        if (!node.getNodeInformation().getURL().contains(currentHost)) {
            Assert.assertTrue("All nodes have to be from " + currentHost, false);
        }
    }
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(7, TopologyDescriptor.BEST_PROXIMITY, null, null);
    Assert.assertEquals(7, ns.size());
    for (Node node : ns) {
        if (node.getNodeInformation().getURL().contains(distantHost)) {
            Assert.assertTrue("Node from distant host selected", false);
        }
    }
    resourceManager.releaseNodes(ns).getBooleanValue();
    // pivot scenario
    // List<Node> pivot = new LinkedList<Node>();
    // pivot.add(pivotNode);
    // ns = resourceManager.getAtMostNodes(6,
    // new BestProximityDescriptor(BestProximityDescriptor.MAX, pivot), null, null);
    // Assert.assertEquals(6, ns.size());
    // for (Node node : ns) {
    // if (node.getNodeInformation().getURL().equals(pivotNode.getNodeInformation().getURL())) {
    // Assert.assertTrue("Pivot must not be in results", false);
    // }
    // if (node.getNodeInformation().getURL().contains(distantHost)) {
    // Assert.assertTrue("Node from distant host selected", false);
    // }
    // }
    // resourceManager.releaseNodes(ns).getBooleanValue();
    // 
    // ns = resourceManager.getAtMostNodes(7,
    // new BestProximityDescriptor(BestProximityDescriptor.MAX, pivot), null, null);
    // Assert.assertEquals(7, ns.size());
    // for (Node node : ns) {
    // if (node.getNodeInformation().getURL().equals(pivotNode.getNodeInformation().getURL())) {
    // Assert.assertTrue("Pivot must not be in results", false);
    // }
    // }
    // resourceManager.releaseNodes(ns).getBooleanValue();
    // checking TopologyDescriptor.ThresholdProximityDescriptor
    ns = resourceManager.getAtMostNodes(1, new ThresholdProximityDescriptor(Long.MAX_VALUE), null, null);
    Assert.assertEquals(1, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(9, new ThresholdProximityDescriptor(Long.MAX_VALUE), null, null);
    Assert.assertEquals(9, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(100, new ThresholdProximityDescriptor(Long.MAX_VALUE), null, null);
    Assert.assertEquals(9, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    // getting information about topology
    Topology topology = resourceManager.getTopology();
    Assert.assertEquals(3, topology.getHosts().size());
    // looking for distances consistency
    Long current2neighborDistance = topology.getDistance(currentHost, neighborHost);
    Long current2distantDistance = topology.getDistance(currentHost, distantHost);
    Long distant2neightborDistance = topology.getDistance(neighborHost, distantHost);
    if (current2neighborDistance == null || current2distantDistance == null) {
        Assert.assertTrue("Please put full host names to the parameters", false);
    }
    if (current2neighborDistance > current2distantDistance) {
        Assert.assertTrue("Distant host is close to current than neighbor according to the topology", false);
    }
    System.out.println("Distance between " + currentHost + " and " + neighborHost + " is " + current2neighborDistance);
    System.out.println("Distance between " + currentHost + " and " + distantHost + " is " + current2distantDistance);
    System.out.println("Distance between " + neighborHost + " and " + distantHost + " is " + distant2neightborDistance);
    long maxThreshold = Math.max(current2neighborDistance, Math.max(current2distantDistance, distant2neightborDistance));
    ns = resourceManager.getAtMostNodes(100, new ThresholdProximityDescriptor(current2neighborDistance - 1), null, null);
    Assert.assertEquals(6, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(100, new ThresholdProximityDescriptor(current2neighborDistance), null, null);
    Assert.assertEquals(7, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(100, new ThresholdProximityDescriptor(maxThreshold - 1), null, null);
    for (Node node : ns) {
        if (node.getNodeInformation().getURL().contains(distantHost)) {
            Assert.assertTrue("Node from distant host selected", false);
        }
    }
    Assert.assertEquals(7, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(10, new ThresholdProximityDescriptor(maxThreshold), null, null);
    Assert.assertEquals(9, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    // pivot scenario
    // ns = resourceManager.getAtMostNodes(1, new ThresholdProximityDescriptor(0, pivot), null, null);
    // Assert.assertEquals(1, ns.size());
    // for (Node node : ns) {
    // if (node.getNodeInformation().getURL().equals(pivotNode.getNodeInformation().getURL())) {
    // Assert.assertTrue("Pivot must not be in results", false);
    // }
    // if (node.getNodeInformation().getURL().contains(distantHost) ||
    // node.getNodeInformation().getURL().contains(neighborHost)) {
    // Assert.assertTrue("Incorrect node selected", false);
    // }
    // }
    // resourceManager.releaseNodes(ns).getBooleanValue();
    // 
    // ns = resourceManager.getAtMostNodes(6, new ThresholdProximityDescriptor(current2neighborDistance,
    // pivot), null, null);
    // Assert.assertEquals(6, ns.size());
    // for (Node node : ns) {
    // if (node.getNodeInformation().getURL().equals(pivotNode.getNodeInformation().getURL())) {
    // Assert.assertTrue("Pivot must not be in results", false);
    // }
    // if (node.getNodeInformation().getURL().contains(distantHost)) {
    // Assert.assertTrue("Node from distant host selected", false);
    // }
    // }
    // resourceManager.releaseNodes(ns).getBooleanValue();
    // checking TopologyDescriptor.SINGLE_HOST
    ns = resourceManager.getAtMostNodes(1, TopologyDescriptor.SINGLE_HOST, null, null);
    Assert.assertEquals(1, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(9, TopologyDescriptor.SINGLE_HOST, null, null);
    Assert.assertEquals(6, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(100, TopologyDescriptor.SINGLE_HOST, null, null);
    Assert.assertEquals(6, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(100, TopologyDescriptor.SINGLE_HOST, scriptList, null);
    Assert.assertEquals(1, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    // checking TopologyDescriptor.SINGLE_HOST_EXCLUSIVE
    ns = resourceManager.getAtMostNodes(1, TopologyDescriptor.SINGLE_HOST_EXCLUSIVE, null, null);
    Assert.assertEquals(1, ns.size());
    Assert.assertEquals(null, ns.getExtraNodes());
    if (!ns.get(0).getNodeInformation().getURL().contains(neighborHost)) {
        Assert.assertTrue("Neighbor host shold be selected", false);
    }
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(9, TopologyDescriptor.SINGLE_HOST_EXCLUSIVE, null, null);
    Assert.assertEquals(6, ns.size());
    Assert.assertEquals(null, ns.getExtraNodes());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(2, TopologyDescriptor.SINGLE_HOST_EXCLUSIVE, null, null);
    Assert.assertEquals(2, ns.size());
    Assert.assertEquals(null, ns.getExtraNodes());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(3, TopologyDescriptor.SINGLE_HOST_EXCLUSIVE, null, null);
    Assert.assertEquals(3, ns.size());
    Assert.assertEquals(3, ns.getExtraNodes().size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(100, TopologyDescriptor.SINGLE_HOST_EXCLUSIVE, scriptList, null);
    // no hosts matched selection script
    Assert.assertEquals(0, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(100, TopologyDescriptor.SINGLE_HOST_EXCLUSIVE, null, null);
    // return the host with max capacity
    Assert.assertEquals(6, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    // checking TopologyDescriptor.MULTIPLE_HOSTS_EXCLUSIVE
    ns = resourceManager.getAtMostNodes(1, TopologyDescriptor.MULTIPLE_HOSTS_EXCLUSIVE, null, null);
    Assert.assertEquals(1, ns.size());
    Assert.assertEquals(null, ns.getExtraNodes());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(2, TopologyDescriptor.MULTIPLE_HOSTS_EXCLUSIVE, null, null);
    Assert.assertEquals(2, ns.size());
    Assert.assertEquals(null, ns.getExtraNodes());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(3, TopologyDescriptor.MULTIPLE_HOSTS_EXCLUSIVE, null, null);
    Assert.assertEquals(3, ns.size());
    Assert.assertEquals(null, ns.getExtraNodes());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(9, TopologyDescriptor.MULTIPLE_HOSTS_EXCLUSIVE, null, null);
    Assert.assertEquals(9, ns.size());
    Assert.assertEquals(null, ns.getExtraNodes());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(8, TopologyDescriptor.MULTIPLE_HOSTS_EXCLUSIVE, null, null);
    // current + distant has to be selected
    Assert.assertEquals(8, ns.size());
    Assert.assertEquals(null, ns.getExtraNodes());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(7, TopologyDescriptor.MULTIPLE_HOSTS_EXCLUSIVE, null, null);
    // current + neighbor has to be selected
    Assert.assertEquals(7, ns.size());
    Assert.assertEquals(null, ns.getExtraNodes());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(100, TopologyDescriptor.MULTIPLE_HOSTS_EXCLUSIVE, scriptList, null);
    // selection script specified => no such set
    Assert.assertEquals(0, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(100, TopologyDescriptor.MULTIPLE_HOSTS_EXCLUSIVE, null, null);
    // get max possible capacity
    Assert.assertEquals(9, ns.size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    // checking TopologyDescriptor.ONE_NODE_PER_HOST_EXCLUSIVE
    ns = resourceManager.getAtMostNodes(1, TopologyDescriptor.DIFFERENT_HOSTS_EXCLUSIVE, null, null);
    Assert.assertEquals(1, ns.size());
    Assert.assertEquals(null, ns.getExtraNodes());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(2, TopologyDescriptor.DIFFERENT_HOSTS_EXCLUSIVE, null, null);
    Assert.assertEquals(2, ns.size());
    Assert.assertEquals(1, ns.getExtraNodes().size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(3, TopologyDescriptor.DIFFERENT_HOSTS_EXCLUSIVE, null, null);
    Assert.assertEquals(3, ns.size());
    Assert.assertEquals(6, ns.getExtraNodes().size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    ns = resourceManager.getAtMostNodes(4, TopologyDescriptor.DIFFERENT_HOSTS_EXCLUSIVE, null, null);
    Assert.assertEquals(3, ns.size());
    Assert.assertEquals(6, ns.getExtraNodes().size());
    resourceManager.releaseNodes(ns).getBooleanValue();
    PAFuture.waitFor(resourceManager.removeNodeSource("remote", true));
}
Also used : NodeSet(org.ow2.proactive.utils.NodeSet) SSHInfrastructure(org.ow2.proactive.resourcemanager.nodesource.infrastructure.SSHInfrastructure) HashMap(java.util.HashMap) StaticPolicy(org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy) Node(org.objectweb.proactive.core.node.Node) ThresholdProximityDescriptor(org.ow2.proactive.topology.descriptor.ThresholdProximityDescriptor) ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager) Topology(org.ow2.proactive.resourcemanager.frontend.topology.Topology) LinkedList(java.util.LinkedList) BooleanWrapper(org.objectweb.proactive.core.util.wrapper.BooleanWrapper) SelectionScript(org.ow2.proactive.scripting.SelectionScript) File(java.io.File) Test(org.junit.Test) RMFunctionalTest(functionaltests.utils.RMFunctionalTest)

Example 17 with ResourceManager

use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.

the class RMNodeSourceHelper method defineLocalNodeSourceAndWait.

public static void defineLocalNodeSourceAndWait(String name, int nodeNumber, ResourceManager rm, RMMonitorsHandler monitor) throws Exception {
    RMFactory.setOsJavaProperty();
    RMTHelper.log("Define a node source " + name);
    byte[] creds = FileToBytesConverter.convertFileToByteArray(new File(PAResourceManagerProperties.getAbsolutePath(PAResourceManagerProperties.RM_CREDS.getValueAsString())));
    rm.defineNodeSource(name, LocalInfrastructure.class.getName(), new Object[] { creds, nodeNumber, RMTHelper.DEFAULT_NODES_TIMEOUT, RMTHelper.setup.getJvmParameters() }, StaticPolicy.class.getName(), null, RMFunctionalTest.NODES_NOT_RECOVERABLE);
    rm.setNodeSourcePingFrequency(5000, name);
    waitForNodeSourceDefinition(name, monitor);
}
Also used : LocalInfrastructure(org.ow2.proactive.resourcemanager.nodesource.infrastructure.LocalInfrastructure) StaticPolicy(org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy) File(java.io.File)

Example 18 with ResourceManager

use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.

the class RMTHelper method createNodeSourceWithInfiniteTimeout.

public static void createNodeSourceWithInfiniteTimeout(String name, int nodeNumber, List<String> vmOptions, ResourceManager rm, RMMonitorsHandler monitor) throws Exception {
    RMFactory.setOsJavaProperty();
    log("Creating a node source " + name);
    // first emtpy im parameter is default rm url
    byte[] creds = FileToBytesConverter.convertFileToByteArray(new File(PAResourceManagerProperties.getAbsolutePath(PAResourceManagerProperties.RM_CREDS.getValueAsString())));
    rm.createNodeSource(name, LocalInfrastructure.class.getName(), new Object[] { creds, nodeNumber, Integer.MAX_VALUE, vmOptions != null ? setup.listToString(vmOptions) : setup.getJvmParameters() }, StaticPolicy.class.getName(), null, NODES_RECOVERABLE);
    rm.setNodeSourcePingFrequency(5000, name);
    waitForNodeSourceCreation(name, nodeNumber, monitor);
}
Also used : LocalInfrastructure(org.ow2.proactive.resourcemanager.nodesource.infrastructure.LocalInfrastructure) StaticPolicy(org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy) File(java.io.File)

Example 19 with ResourceManager

use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.

the class RMRest method defineNodeSource.

@Override
@POST
@Path("nodesource")
@Produces("application/json")
public NSState defineNodeSource(@HeaderParam("sessionid") String sessionId, @FormParam("nodeSourceName") String nodeSourceName, @FormParam("infrastructureType") String infrastructureType, @FormParam("infrastructureParameters") String[] infrastructureParameters, @FormParam("infrastructureFileParameters") String[] infrastructureFileParameters, @FormParam("policyType") String policyType, @FormParam("policyParameters") String[] policyParameters, @FormParam("policyFileParameters") String[] policyFileParameters, @FormParam("nodesRecoverable") String nodesRecoverable) throws NotConnectedException {
    ResourceManager rm = checkAccess(sessionId);
    NSState nsState = new NSState();
    Object[] infraParams = this.getAllInfrastructureParameters(infrastructureType, infrastructureParameters, infrastructureFileParameters, rm);
    Object[] policyParams = this.getAllPolicyParameters(policyType, policyParameters, policyFileParameters, rm);
    try {
        nsState.setResult(rm.defineNodeSource(nodeSourceName, infrastructureType, infraParams, policyType, policyParams, Boolean.parseBoolean(nodesRecoverable)).getBooleanValue());
    } catch (RuntimeException ex) {
        nsState.setResult(false);
        nsState.setErrorMessage(cleanDisplayedErrorMessage(ex.getMessage()));
        nsState.setStackTrace(StringEscapeUtils.escapeJson(getStackTrace(ex)));
    }
    return nsState;
}
Also used : ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager) NSState(org.ow2.proactive.resourcemanager.common.NSState) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 20 with ResourceManager

use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.

the class TestOperationsWhenUnlinked method testSubmitAndPause.

@Test
public void testSubmitAndPause() throws Throwable {
    Scheduler scheduler = schedulerHelper.getSchedulerInterface();
    log("Submitting job");
    JobId jobId1 = scheduler.submit(createJob());
    log("Killing RM");
    rmHelper.killRM();
    log("Waiting RM_DOWN event");
    schedulerHelper.waitForEventSchedulerState(SchedulerEvent.RM_DOWN, EVENT_TIMEOUT);
    log("Submitting new job");
    JobId jobId2 = scheduler.submit(createJob());
    if (!scheduler.pauseJob(jobId2)) {
        fail("Failed to pause job " + jobId2);
    }
    if (!scheduler.resumeJob(jobId2)) {
        fail("Failed to resume job " + jobId2);
    }
    log("Creating new RM");
    rmHelper = new RMTHelper();
    rmHelper.startRM(null, pnp_port);
    ResourceManager rm = rmHelper.getResourceManager();
    testNode = RMTHelper.createNode("test-node");
    String nodeUrl = testNode.getNode().getNodeInformation().getURL();
    rm.addNode(nodeUrl);
    rmHelper.waitForAnyNodeEvent(RMEventType.NODE_ADDED);
    log("Linking new RM");
    if (!scheduler.linkResourceManager(rmHelper.getLocalUrl())) {
        fail("Failed to link another RM");
    }
    log("Waiting when jobs finish");
    schedulerHelper.waitForEventJobFinished(jobId1, EVENT_TIMEOUT);
    schedulerHelper.waitForEventJobFinished(jobId2, EVENT_TIMEOUT);
    checkJobResult(scheduler, jobId1, 1);
    checkJobResult(scheduler, jobId2, 1);
}
Also used : Scheduler(org.ow2.proactive.scheduler.common.Scheduler) ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager) JobId(org.ow2.proactive.scheduler.common.job.JobId) ProActiveTest(org.ow2.tests.ProActiveTest)

Aggregations

ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)45 NodeSet (org.ow2.proactive.utils.NodeSet)26 RMFunctionalTest (functionaltests.utils.RMFunctionalTest)25 Test (org.junit.Test)25 Node (org.objectweb.proactive.core.node.Node)16 File (java.io.File)14 Credentials (org.ow2.proactive.authentication.crypto.Credentials)14 Criteria (org.ow2.proactive.utils.Criteria)13 HashMap (java.util.HashMap)11 CredData (org.ow2.proactive.authentication.crypto.CredData)11 StaticPolicy (org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy)11 RMAuthentication (org.ow2.proactive.resourcemanager.authentication.RMAuthentication)10 RMNodeEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeEvent)10 TestNode (functionaltests.utils.TestNode)9 SelectionScript (org.ow2.proactive.scripting.SelectionScript)9 RMMonitorEventReceiver (functionaltests.monitor.RMMonitorEventReceiver)5 Path (javax.ws.rs.Path)5 Produces (javax.ws.rs.Produces)5 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)5 PublicKey (java.security.PublicKey)4