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");
}
}
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;
}
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;
}
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());
}
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);
}
Aggregations