Search in sources :

Example 1 with RMMonitorEventReceiver

use of functionaltests.monitor.RMMonitorEventReceiver in project scheduling by ow2-proactive.

the class TestExecRemote method action.

@Test
public void action() throws Exception {
    final String miscDir = System.getProperty("pa.rm.home") + File.separator + "samples" + File.separator + "scripts" + File.separator + "misc" + File.separator;
    boolean isLinux = OperatingSystem.getOperatingSystem().equals(OperatingSystem.unix);
    final String valueToEcho = "111";
    String nsName = "TestExecRemote";
    rmHelper.createNodeSource(nsName);
    RMInitialState state = ((RMMonitorEventReceiver) rmHelper.getResourceManager()).getInitialState();
    String hostname = state.getNodeEvents().get(0).getHostName();
    HashSet<String> nodesUrls = new HashSet<>();
    for (RMNodeEvent ne : state.getNodeEvents()) {
        nodesUrls.add(ne.getNodeUrl());
    }
    simpleScript(nodesUrls);
    selectionScript(nodesUrls);
    processBuilderScript(miscDir, isLinux, valueToEcho, nodesUrls);
    processBuilderWithDSScript(miscDir, isLinux, valueToEcho, nodesUrls);
    scriptOnNodeSource(nsName, nodesUrls);
    scriptOnHost(hostname);
}
Also used : RMInitialState(org.ow2.proactive.resourcemanager.common.event.RMInitialState) RMNodeEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeEvent) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver) HashSet(java.util.HashSet) Test(org.junit.Test) RMFunctionalTest(functionaltests.utils.RMFunctionalTest)

Example 2 with RMMonitorEventReceiver

use of functionaltests.monitor.RMMonitorEventReceiver in project scheduling by ow2-proactive.

the class NodesRecoveryPropertyTest method startRmAndCheckInitialState.

private void startRmAndCheckInitialState(String rmConfigPath, boolean nodesRecoverable) throws Exception {
    // start RM
    startRmWithConfig(rmConfigPath);
    assertThat(PAResourceManagerProperties.RM_PRESERVE_NODES_ON_SHUTDOWN.getValueAsBoolean()).isTrue();
    assertThat(rmHelper.isRMStarted()).isTrue();
    // check the initial state of the RM
    assertThat(resourceManager.getState().getAllNodes().size()).isEqualTo(0);
    if (nodesRecoverable) {
        rmHelper.createNodeSourceWithNodesRecoverable(NODE_SOURCE_NAME, NODE_NUMBER);
    } else {
        rmHelper.createNodeSource(NODE_SOURCE_NAME, NODE_NUMBER);
    }
    RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) resourceManager;
    List<RMNodeSourceEvent> nodeSourceEventPerNodeSource = resourceManagerMonitor.getInitialState().getNodeSourceEvents();
    assertThat(nodeSourceEventPerNodeSource.size()).isEqualTo(1);
    assertThat(nodeSourceEventPerNodeSource.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME);
    assertThat(resourceManagerMonitor.getState().getAllNodes().size()).isEqualTo(NODE_NUMBER);
}
Also used : RMNodeSourceEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver)

Example 3 with RMMonitorEventReceiver

use of functionaltests.monitor.RMMonitorEventReceiver in project scheduling by ow2-proactive.

the class RecoverLocalInfrastructureTest method restartRmAndCheckFinalState.

private void restartRmAndCheckFinalState(boolean nodesShouldBeRecreated) throws Exception {
    // restart RM
    this.rmHelper = new RMTHelper();
    this.startRmWithConfig(RESTART_CONFIG);
    assertThat(PAResourceManagerProperties.RM_PRESERVE_NODES_ON_SHUTDOWN.getValueAsBoolean()).isFalse();
    assertThat(this.rmHelper.isRMStarted()).isTrue();
    // re-snapshot the RM state
    RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) this.resourceManager;
    List<RMNodeSourceEvent> nodeSourceEvent = resourceManagerMonitor.getInitialState().getNodeSourceEvents();
    // the node source has been recovered on restart: we should have one node source with the same name
    assertThat(nodeSourceEvent.size()).isEqualTo(1);
    assertThat(nodeSourceEvent.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME);
    // wait for nodes to be recreated if needed
    if (nodesShouldBeRecreated) {
        this.rmHelper.waitForAnyMultipleNodeEvent(RMEventType.NODE_STATE_CHANGED, NODE_NUMBER);
    }
}
Also used : RMNodeSourceEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent) RMTHelper(functionaltests.utils.RMTHelper) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver)

Example 4 with RMMonitorEventReceiver

use of functionaltests.monitor.RMMonitorEventReceiver in project scheduling by ow2-proactive.

the class RecoverLocalInfrastructureTest method createNodeSourceAndCheckState.

private void createNodeSourceAndCheckState() throws Exception {
    this.rmHelper.createNodeSourceWithNodesRecoverable(NODE_SOURCE_NAME, NODE_NUMBER);
    RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) this.resourceManager;
    List<RMNodeSourceEvent> nodeSourceEventPerNodeSource = resourceManagerMonitor.getInitialState().getNodeSourceEvents();
    assertThat(nodeSourceEventPerNodeSource.size()).isEqualTo(1);
    RMNodeSourceEvent rmNodeSourceEvent = nodeSourceEventPerNodeSource.get(0);
    assertThat(rmNodeSourceEvent.getSourceName()).isEqualTo(NODE_SOURCE_NAME);
    assertThat(rmNodeSourceEvent.getNodeSourceStatus()).isEqualTo(NodeSourceStatus.NODES_DEPLOYED.toString());
    assertThat(resourceManagerMonitor.getState().getAllNodes().size()).isEqualTo(NODE_NUMBER);
}
Also used : RMNodeSourceEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver)

Example 5 with RMMonitorEventReceiver

use of functionaltests.monitor.RMMonitorEventReceiver in project scheduling by ow2-proactive.

the class RecoverLocalInfrastructureTest method checkNodesStateAfterRecovery.

private void checkNodesStateAfterRecovery(int expectedNumberOfNodes) {
    RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) this.resourceManager;
    // the nodes should have been recovered too, and should be alive
    Set<String> allNodes = resourceManagerMonitor.getState().getAllNodes();
    assertThat(allNodes.size()).isEqualTo(expectedNumberOfNodes);
    Set<String> nodeSourceNames = new HashSet<>();
    nodeSourceNames.add(NODE_SOURCE_NAME);
    Set<String> aliveNodeUrls = this.resourceManager.listAliveNodeUrls(nodeSourceNames);
    assertThat(aliveNodeUrls.size()).isEqualTo(expectedNumberOfNodes);
    if (expectedNumberOfNodes > 0) {
        // the recovered nodes should be usable, try to lock/unlock them to see
        BooleanWrapper lockSucceeded = this.resourceManager.lockNodes(allNodes);
        assertThat(lockSucceeded).isEqualTo(new BooleanWrapper(true));
        BooleanWrapper unlockSucceeded = this.resourceManager.unlockNodes(allNodes);
        assertThat(unlockSucceeded).isEqualTo(new BooleanWrapper(true));
    }
}
Also used : BooleanWrapper(org.objectweb.proactive.core.util.wrapper.BooleanWrapper) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver) HashSet(java.util.HashSet)

Aggregations

RMMonitorEventReceiver (functionaltests.monitor.RMMonitorEventReceiver)15 RMNodeSourceEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent)8 HashSet (java.util.HashSet)4 RMMonitorsHandler (functionaltests.monitor.RMMonitorsHandler)3 RMTHelper (functionaltests.utils.RMTHelper)3 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)3 RMInitialState (org.ow2.proactive.resourcemanager.common.event.RMInitialState)3 RMFunctionalTest (functionaltests.utils.RMFunctionalTest)2 Test (org.junit.Test)2 CredData (org.ow2.proactive.authentication.crypto.CredData)2 TestSSHInfrastructureV2 (functionaltests.nodesource.TestSSHInfrastructureV2)1 AbstractMap (java.util.AbstractMap)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 After (org.junit.After)1 Before (org.junit.Before)1 PAActiveObject (org.objectweb.proactive.api.PAActiveObject)1 Credentials (org.ow2.proactive.authentication.crypto.Credentials)1 RMNodeEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeEvent)1 ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)1