Search in sources :

Example 6 with RMNodeSourceEvent

use of org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent 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 7 with RMNodeSourceEvent

use of org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent 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 8 with RMNodeSourceEvent

use of org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent in project scheduling by ow2-proactive.

the class RecoverLocalInfrastructureTest method defineNodeSourceAndCheckState.

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

Example 9 with RMNodeSourceEvent

use of org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent in project scheduling by ow2-proactive.

the class NodesRecoveryPropertyTest method restartRmAndCheckFinalState.

private void restartRmAndCheckFinalState(String rmConfigPath, boolean nodesShouldBeRecreated) throws Exception {
    // restart RM
    rmHelper = new RMTHelper();
    startRmWithConfig(rmConfigPath);
    assertThat(PAResourceManagerProperties.RM_PRESERVE_NODES_ON_SHUTDOWN.getValueAsBoolean()).isFalse();
    assertThat(rmHelper.isRMStarted()).isTrue();
    // re-snapshot the RM state
    RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) 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
    if (PAResourceManagerProperties.RM_NODES_RECOVERY.getValueAsBoolean()) {
        assertThat(nodeSourceEvent.size()).isEqualTo(1);
    }
    assertThat(nodeSourceEvent.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME);
    // wait for nodes to be recreated if needed
    if (nodesShouldBeRecreated) {
        rmHelper.waitForAnyMultipleNodeEvent(RMEventType.NODE_STATE_CHANGED, NODE_NUMBER);
    }
    // the nodes should have been recovered too, and should be alive
    Set<String> allNodes = resourceManagerMonitor.getState().getAllNodes();
    assertThat(allNodes.size()).isEqualTo(NODE_NUMBER);
    Set<String> nodeSourceNames = new HashSet<>();
    nodeSourceNames.add(NODE_SOURCE_NAME);
    Set<String> aliveNodeUrls = resourceManager.listAliveNodeUrls(nodeSourceNames);
    assertThat(aliveNodeUrls.size()).isEqualTo(NODE_NUMBER);
    // the recovered nodes should be usable, try to lock/unlock them to see
    BooleanWrapper lockSucceeded = resourceManager.lockNodes(allNodes);
    assertThat(lockSucceeded).isEqualTo(new BooleanWrapper(true));
    BooleanWrapper unlockSucceeded = resourceManager.unlockNodes(allNodes);
    assertThat(unlockSucceeded).isEqualTo(new BooleanWrapper(true));
}
Also used : RMNodeSourceEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent) BooleanWrapper(org.objectweb.proactive.core.util.wrapper.BooleanWrapper) RMTHelper(functionaltests.utils.RMTHelper) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver) HashSet(java.util.HashSet)

Example 10 with RMNodeSourceEvent

use of org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent in project scheduling by ow2-proactive.

the class RecoverSSHInfrastructureV2Test method restartRmAndCheckFinalState.

private void restartRmAndCheckFinalState(boolean nodesShouldBeRecreated) throws Exception {
    // restart RM
    rmHelper = new RMTHelper();
    startRmWithConfig(RESTART_CONFIG);
    assertThat(PAResourceManagerProperties.RM_PRESERVE_NODES_ON_SHUTDOWN.getValueAsBoolean()).isFalse();
    assertThat(rmHelper.isRMStarted()).isTrue();
    // re-snapshot the RM state
    RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) 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) {
        rmHelper.waitForAnyMultipleNodeEvent(RMEventType.NODE_STATE_CHANGED, TestSSHInfrastructureV2.NB_NODES);
    }
    // the nodes should have been recovered too, and should be alive
    Set<String> allNodes = resourceManagerMonitor.getState().getAllNodes();
    assertThat(allNodes.size()).isEqualTo(TestSSHInfrastructureV2.NB_NODES);
    Set<String> nodeSourceNames = new HashSet<>();
    nodeSourceNames.add(NODE_SOURCE_NAME);
    Set<String> aliveNodeUrls = resourceManager.listAliveNodeUrls(nodeSourceNames);
    assertThat(aliveNodeUrls.size()).isEqualTo(TestSSHInfrastructureV2.NB_NODES);
    // the recovered nodes should be usable, try to lock/unlock them to see
    BooleanWrapper lockSucceeded = resourceManager.lockNodes(allNodes);
    assertThat(lockSucceeded).isEqualTo(new BooleanWrapper(true));
    BooleanWrapper unlockSucceeded = resourceManager.unlockNodes(allNodes);
    assertThat(unlockSucceeded).isEqualTo(new BooleanWrapper(true));
}
Also used : RMNodeSourceEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent) BooleanWrapper(org.objectweb.proactive.core.util.wrapper.BooleanWrapper) RMTHelper(functionaltests.utils.RMTHelper) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver) HashSet(java.util.HashSet)

Aggregations

RMNodeSourceEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent)14 RMMonitorEventReceiver (functionaltests.monitor.RMMonitorEventReceiver)8 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)6 NodeSource (org.ow2.proactive.resourcemanager.nodesource.NodeSource)4 RMTHelper (functionaltests.utils.RMTHelper)3 HashSet (java.util.HashSet)3 NodeSourceDescriptor (org.ow2.proactive.resourcemanager.nodesource.NodeSourceDescriptor)3 RMInitialState (org.ow2.proactive.resourcemanager.common.event.RMInitialState)2 ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)2 StaticPolicy (org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Function (com.google.common.base.Function)1 Predicate (com.google.common.base.Predicate)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 TestSSHInfrastructureV2 (functionaltests.nodesource.TestSSHInfrastructureV2)1 Serializable (java.io.Serializable)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 Permission (java.security.Permission)1 ArrayList (java.util.ArrayList)1