Search in sources :

Example 51 with ResourceManager

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);
}
Also used : ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager)

Example 52 with ResourceManager

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;
}
Also used : ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager)

Example 53 with ResourceManager

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;
}
Also used : UserHistory(org.ow2.proactive.resourcemanager.core.history.UserHistory) IOException(java.io.IOException) ActiveObjectCreationException(org.objectweb.proactive.ActiveObjectCreationException)

Example 54 with ResourceManager

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);
        }
    }
}
Also used : ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager)

Example 55 with ResourceManager

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);
}
Also used : RMAuthentication(org.ow2.proactive.resourcemanager.authentication.RMAuthentication) ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager) URI(java.net.URI) Credentials(org.ow2.proactive.authentication.crypto.Credentials) SchedulerHsqldbStarter(org.ow2.proactive.scheduler.util.SchedulerHsqldbStarter)

Aggregations

ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)45 NodeSet (org.ow2.proactive.utils.NodeSet)26 RMFunctionalTest (functionaltests.utils.RMFunctionalTest)25 Test (org.junit.Test)25 Node (org.objectweb.proactive.core.node.Node)16 File (java.io.File)14 Credentials (org.ow2.proactive.authentication.crypto.Credentials)14 Criteria (org.ow2.proactive.utils.Criteria)13 HashMap (java.util.HashMap)11 CredData (org.ow2.proactive.authentication.crypto.CredData)11 StaticPolicy (org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy)11 RMAuthentication (org.ow2.proactive.resourcemanager.authentication.RMAuthentication)10 RMNodeEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeEvent)10 TestNode (functionaltests.utils.TestNode)9 SelectionScript (org.ow2.proactive.scripting.SelectionScript)9 RMMonitorEventReceiver (functionaltests.monitor.RMMonitorEventReceiver)5 Path (javax.ws.rs.Path)5 Produces (javax.ws.rs.Produces)5 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)5 PublicKey (java.security.PublicKey)4