Search in sources :

Example 56 with ResourceManager

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

the class TestScheduler method startLocalNodes.

private static void startLocalNodes(SchedulerTestConfiguration configuration) throws KeyException, LoginException, InterruptedException {
    if (configuration.hasLocalNodes()) {
        // Waiting while all the nodes will be registered in the RM.
        // Without waiting test can finish earlier than nodes are added.
        // It leads to test execution hang up on windows due to running processes.
        Credentials creds = Credentials.createCredentials(new CredData(CredData.parseLogin(TestUsers.DEMO.username), CredData.parseDomain(TestUsers.DEMO.username), TestUsers.DEMO.password), rmAuth.getPublicKey());
        ResourceManager rm = rmAuth.login(creds);
        while (rm.getState().getTotalAliveNodesNumber() < SchedulerStartForFunctionalTest.RM_NODE_NUMBER) {
            Thread.sleep(50);
        }
        PAFuture.waitFor(rm.disconnect());
        System.out.println("Nodes are deployed");
    }
}
Also used : CredData(org.ow2.proactive.authentication.crypto.CredData) ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager) Credentials(org.ow2.proactive.authentication.crypto.Credentials)

Example 57 with ResourceManager

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

the class SchedulerStarter method addLocalNodes.

private static void addLocalNodes(RMAuthentication rmAuth, int numberLocalNodes, int nodeTimeoutValue) throws LoginException, KeyException, IOException {
    // creating default node source
    ResourceManager rman = rmAuth.login(Credentials.getCredentials(PAResourceManagerProperties.getAbsolutePath(PAResourceManagerProperties.RM_CREDS.getValueAsString())));
    // first im parameter is default rm url
    byte[] creds = FileToBytesConverter.convertFileToByteArray(new File(PAResourceManagerProperties.getAbsolutePath(PAResourceManagerProperties.RM_CREDS.getValueAsString())));
    rman.createNodeSource(NodeSource.DEFAULT_LOCAL_NODES_NODE_SOURCE_NAME, LocalInfrastructure.class.getName(), new Object[] { creds, numberLocalNodes, nodeTimeoutValue, "" }, RestartDownNodesPolicy.class.getName(), new Object[] { "ALL", "ALL", "10000" }, NodeSource.DEFAULT_LOCAL_NODES_NODE_SOURCE_RECOVERABLE);
    credentials = creds;
}
Also used : RestartDownNodesPolicy(org.ow2.proactive.resourcemanager.nodesource.policy.RestartDownNodesPolicy) LocalInfrastructure(org.ow2.proactive.resourcemanager.nodesource.infrastructure.LocalInfrastructure) ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager) File(java.io.File)

Example 58 with ResourceManager

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

the class RunningTaskRecoveryWhenNodesAreReservedInBatchTest method printRmStateAndReturnNotFreeNodeNumber.

private int printRmStateAndReturnNotFreeNodeNumber() throws Exception {
    ResourceManager rm = schedulerHelper.getResourceManager();
    RMState rmState = rm.getState();
    int totalNodesNumber = rmState.getTotalNodesNumber();
    int freeNodesNumber = rmState.getFreeNodesNumber();
    // just to give *an idea* of how many node are free/busy  just before
    // killing the scheduler
    SchedulerTHelper.log("Total node number " + totalNodesNumber);
    SchedulerTHelper.log("Free node number " + freeNodesNumber);
    return totalNodesNumber - freeNodesNumber;
}
Also used : ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager) RMState(org.ow2.proactive.resourcemanager.common.RMState)

Example 59 with ResourceManager

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

the class TestRMProxy method requestTooManyNodes.

private void requestTooManyNodes(RMProxy proxy, ResourceManager rm) throws Exception {
    log("Request more nodes than RM has");
    Criteria criteria = new Criteria(NODES_NUMBER + 1);
    criteria.setBestEffort(false);
    NodeSet nodeSet = proxy.getNodes(criteria);
    PAFuture.waitFor(nodeSet);
    assertEquals(0, nodeSet.size());
    assertEquals(NODES_NUMBER, rm.getState().getFreeNodesNumber());
}
Also used : NodeSet(org.ow2.proactive.utils.NodeSet) Criteria(org.ow2.proactive.utils.Criteria)

Example 60 with ResourceManager

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

the class TestRMProxy method testRMProxies.

private void testRMProxies(boolean singleUserConnection) throws Exception {
    ResourceManager rm = rmHelper.getResourceManager();
    assertEquals(NODES_NUMBER, rm.getState().getFreeNodesNumber());
    URI rmUri = new URI(RMTHelper.getLocalUrl());
    Credentials schedulerProxyCredentials = Credentials.getCredentials(PASchedulerProperties.getAbsolutePath(PASchedulerProperties.RESOURCE_MANAGER_CREDS.getValueAsString()));
    if (singleUserConnection) {
        proxiesManager = new SingleConnectionRMProxiesManager(rmUri, schedulerProxyCredentials);
    } else {
        proxiesManager = new PerUserConnectionRMProxiesManager(rmUri, schedulerProxyCredentials);
    }
    RMProxy user1RMProxy = proxiesManager.getUserRMProxy("admin", user1Credentials);
    assertSame("Proxy manager should return cached proxy instance", user1RMProxy, proxiesManager.getUserRMProxy("admin", user1Credentials));
    RMProxy user2RMProxy = proxiesManager.getUserRMProxy("demo", user2Credentials);
    assertSame("Proxy manager should return cached proxy instance", user2RMProxy, proxiesManager.getUserRMProxy("demo", user2Credentials));
    requestReleaseOneNode(user1RMProxy, rm);
    testSplitNodeSet(user1RMProxy, rm);
    checkSchedulerProxy(proxiesManager);
    requestWithExtraNodes(user1RMProxy, rm);
    requestTooManyNodes(user1RMProxy, rm);
    requestReleaseAllNodes(user1RMProxy, rm);
    checkSchedulerProxy(proxiesManager);
    requestReleaseOneNode(user2RMProxy, rm);
    requestReleaseAllNodes(user2RMProxy, rm);
    requestWithTwoUsers(user1RMProxy, user2RMProxy, rm);
    checkSchedulerProxy(proxiesManager);
    log("Terminate user proxy1");
    proxiesManager.terminateRMProxy("admin");
    user1RMProxy = proxiesManager.getUserRMProxy("admin", user1Credentials);
    requestReleaseAllNodes(user1RMProxy, rm);
    log("Terminate user proxy2");
    proxiesManager.terminateRMProxy("demo");
    user2RMProxy = proxiesManager.getUserRMProxy("demo", user2Credentials);
    requestReleaseAllNodes(user2RMProxy, rm);
}
Also used : RMProxy(org.ow2.proactive.scheduler.core.rmproxies.RMProxy) PerUserConnectionRMProxiesManager(org.ow2.proactive.scheduler.core.rmproxies.PerUserConnectionRMProxiesManager) ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager) URI(java.net.URI) SingleConnectionRMProxiesManager(org.ow2.proactive.scheduler.core.rmproxies.SingleConnectionRMProxiesManager) Credentials(org.ow2.proactive.authentication.crypto.Credentials)

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