use of org.ow2.proactive.resourcemanager.common.RMState in project scheduling by ow2-proactive.
the class SchedulingMethodImpl method getFreeResources.
private Set<String> getFreeResources(Policy currentPolicy) {
RMState rmState = getRMProxiesManager().getRmProxy().getState();
currentPolicy.setRMState(rmState);
Set<String> freeResources = rmState.getFreeNodes();
if (logger.isDebugEnabled()) {
logger.debug("eligible nodes : " + (freeResources.size() < 5 ? freeResources : freeResources.size()));
}
return freeResources;
}
use of org.ow2.proactive.resourcemanager.common.RMState in project scheduling by ow2-proactive.
the class SessionSharingTest method sessions_are_shared_rm_login.
@Test
public void sessions_are_shared_rm_login() throws Exception {
String sessionId = rmRest.rmConnect("login", "pw");
assertTrue(studioRest.getWorkflows(sessionId).isEmpty());
when(schedulerMock.freeze()).thenReturn(true);
boolean frozen = schedulerRest.freezeScheduler(sessionId);
assertTrue(frozen);
when(rmMock.getState()).thenReturn(new RMState(new RMStateNodeUrls(new HashSet<String>(), new HashSet<String>(), new HashSet<String>()), Long.valueOf(-1)));
RMState rmState = rmRest.getState(sessionId);
assertNotNull(rmState);
rmRest.rmDisconnect(sessionId);
try {
rmRest.getState(sessionId);
fail();
} catch (NotConnectedException expected) {
// expected
}
try {
schedulerRest.freezeScheduler(sessionId);
fail();
} catch (NotConnectedRestException expected) {
// expected
}
}
use of org.ow2.proactive.resourcemanager.common.RMState in project scheduling by ow2-proactive.
the class LocalInfrastructureLifecycleTest method checkResourceManagerState.
private void checkResourceManagerState(int expectedNumberOfNodes) {
RMState s = this.resourceManager.getState();
assertEquals(expectedNumberOfNodes, s.getTotalNodesNumber());
assertEquals(expectedNumberOfNodes, s.getFreeNodesNumber());
}
use of org.ow2.proactive.resourcemanager.common.RMState in project scheduling by ow2-proactive.
the class SSHInfrastructureV2LifecycleTest method checkResourceManagerState.
private void checkResourceManagerState(int expectedNumberOfNodes) {
RMState s = this.resourceManager.getState();
assertEquals(expectedNumberOfNodes, s.getTotalNodesNumber());
assertEquals(expectedNumberOfNodes, s.getFreeNodesNumber());
}
use of org.ow2.proactive.resourcemanager.common.RMState in project scheduling by ow2-proactive.
the class TestLocalInfrastructureRestartDownNodesPolicy method testRestartDownNodesPolicyWithNullParams.
@Test
public void testRestartDownNodesPolicyWithNullParams() throws Exception {
RMTHelper.log("Test 0 - create down nodes policy with null parameters (null is a valid input)");
nodeSourceName = "Node_source_0";
createNodeSourceWithNodes(nodeSourceName, null);
RMState stateTest0 = resourceManager.getState();
assertEquals(defaultDescriptorNodesNb, stateTest0.getTotalNodesNumber());
assertEquals(defaultDescriptorNodesNb, stateTest0.getFreeNodesNumber());
}
Aggregations