use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.
the class RMNodeStarter method connectToResourceManager.
private void connectToResourceManager(String nodeName, Map<String, Node> nodes) {
ResourceManager rm = this.registerInRM(credentials, rmURL, nodeName, nodes.values());
resetReconnectionAttemptsLeft();
pingAllNodes(nodes, rm);
}
use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.
the class RMNodeStarter method loginToResourceManager.
private ResourceManager loginToResourceManager(final Credentials credentials, final RMAuthentication auth) {
try {
ResourceManager rm = auth.login(credentials);
if (rm == null) {
logger.error(ExitStatus.RM_NULL.description);
System.exit(ExitStatus.RM_NULL.exitCode);
}
return rm;
} catch (Throwable t) {
logger.error("Unable to log into the Resource Manager at " + rmURL, t);
System.exit(ExitStatus.RMNODE_ADD_ERROR.exitCode);
}
return null;
}
use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.
the class RMAuthenticationImpl method login.
/**
* Performs user authentication
*/
public ResourceManager login(Credentials cred) throws LoginException {
Client client = new Client(authenticate(cred), true);
client.setCredentials(cred);
if (RMCore.clients.containsKey(client.getId())) {
logger.info(client + " reconnected.");
}
RMCore.clients.put(client.getId(), client);
UserHistory history = new UserHistory(client);
RMDBManager.getInstance().saveUserHistory(history);
client.setHistory(history);
logger.info(client + " connected from " + client.getId().shortString());
try {
// return the stub on ResourceManager interface to keep avoid using server class on client side
return PAActiveObject.lookupActive(ResourceManager.class, PAActiveObject.getUrl(rmcore));
} catch (ActiveObjectCreationException e) {
rethrowStubException(e);
} catch (IOException e) {
rethrowStubException(e);
}
return null;
}
use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.
the class SchedulerFunctionalTest method cleanupScheduler.
/**
* Remove the "extra" node source and checks that the number of alive nodes after the test is the default
*
* @throws Exception
*/
public static void cleanupScheduler() throws Exception {
if (schedulerHelper.isStarted()) {
SchedulerTHelper.log("Do not kill the scheduler after test, but clean extra nodes.");
schedulerHelper.removeExtraNodeSource();
schedulerHelper.cleanJobs();
ResourceManager resourceManager = schedulerHelper.getResourceManager();
int numberOfNodesAfterTest = resourceManager.listAliveNodeUrls().size();
if (resourceManager.listAliveNodeUrls().size() != RMTHelper.DEFAULT_NODES_NUMBER) {
SchedulerTHelper.log("Unexpected number of nodes after test: " + numberOfNodesAfterTest + ", scheduler will be restarted and test declared failing.");
schedulerHelper.killScheduler();
fail("Unexpected number of nodes after test : " + numberOfNodesAfterTest);
}
}
}
use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.
the class SchedulerStartForFunctionalTest method createRMAndScheduler.
private static void createRMAndScheduler(String[] args) throws Exception {
final boolean deployLocalNodes = Boolean.valueOf(args[0]);
String schedPropPath = args[1];
String rmPropPath = args[2];
PAResourceManagerProperties.updateProperties(rmPropPath);
PASchedulerProperties.updateProperties(schedPropPath);
RMFactory.setOsJavaProperty();
new SchedulerHsqldbStarter().startIfNeeded();
new Thread() {
public void run() {
try {
RMFactory.startLocal();
// waiting the initialization
RMAuthentication rmAuth = RMConnection.waitAndJoin(schedulerUrl);
if (deployLocalNodes) {
Credentials credentials = Credentials.getCredentials(PAResourceManagerProperties.getAbsolutePath(PAResourceManagerProperties.RM_CREDS.getValueAsString()));
ResourceManager rmAdmin = rmAuth.login(credentials);
rmAdmin.createNodeSource(RM_NODE_NAME, LocalInfrastructure.class.getName(), new Object[] { credentials.getBase64(), RM_NODE_NUMBER, RM_NODE_DEPLOYMENT_TIMEOUT, getJavaPropertiesLine() }, StaticPolicy.class.getName(), new Object[] { "ALL", "ALL" }, NODES_NOT_RECOVERABLE);
rmAdmin.disconnect();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}.start();
schedulerUrl = "pnp://localhost:" + PNPConfig.PA_PNP_PORT.getValue() + "/";
SchedulerFactory.createScheduler(new URI(schedulerUrl), PASchedulerProperties.SCHEDULER_DEFAULT_POLICY.getValueAsString());
SchedulerConnection.waitAndJoin(schedulerUrl);
}
Aggregations