Search in sources :

Example 1 with SchedulerHsqldbStarter

use of org.ow2.proactive.scheduler.util.SchedulerHsqldbStarter in project scheduling by ow2-proactive.

the class SchedulerStarter method start.

protected static void start(CommandLine commandLine) throws Exception {
    long startTime = System.nanoTime();
    // force properties loading to find out if PAMR router should be started
    ProActiveConfiguration.load();
    checkConfigureConflict();
    if (!commandLine.hasOption(OPTION_NO_ROUTER)) {
        startRouter();
    }
    LOGGER.info("Activeeon ProActive version " + getSchedulerVersion());
    hsqldbServer = new SchedulerHsqldbStarter();
    hsqldbServer.startIfNeeded();
    rmURL = getRmUrl(commandLine);
    setCleanDatabaseProperties(commandLine);
    setCleanNodesourcesProperty(commandLine);
    rmURL = connectToOrStartResourceManager(commandLine, rmURL);
    if (commandLine.hasOption(OPTION_RM_ONLY)) {
        return;
    }
    if (commandLine.hasOption(OPTION_PAUSED)) {
        initialStatus = SchedulerStatus.PAUSED;
    }
    if (commandLine.hasOption(OPTION_FROZEN)) {
        initialStatus = SchedulerStatus.FROZEN;
    }
    if (commandLine.hasOption(OPTION_STOPPED)) {
        initialStatus = SchedulerStatus.STOPPED;
    }
    schedulerURL = getSchedulerUrl(commandLine);
    if (commandLine.hasOption(OPTION_NO_REST)) {
        System.setProperty(REST_DISABLED_PROPERTY, "true");
        PASchedulerProperties.JETTY_STARTED.updateProperty("true");
    } else {
        PASchedulerProperties.JETTY_STARTED.updateProperty("false");
    }
    if (!commandLine.hasOption(OPTION_SCHEDULER_URL)) {
        SchedulerAuthenticationInterface schedulerAuthenticationInterface = startScheduler(commandLine, rmURL);
        schedulerURL = schedulerAuthenticationInterface.getHostURL();
        schedAuthInter = schedulerAuthenticationInterface;
    }
    if (!commandLine.hasOption(OPTION_NO_REST)) {
        long jettyStartTime = System.nanoTime();
        startJetty(rmURL, schedulerURL);
        long jettyEndTime = System.nanoTime();
        LOGGER.debug("Jetty started in " + String.valueOf(((double) jettyEndTime - jettyStartTime) / 1_000_000_000) + " seconds");
        PASchedulerProperties.JETTY_STARTED.updateProperty("true");
    }
    addShutdownMessageHook();
    executeStartScripts();
    long endTime = System.nanoTime();
    LOGGER.info("ProActive started in " + String.valueOf(((double) endTime - startTime) / 1_000_000_000) + " seconds");
}
Also used : SchedulerAuthenticationInterface(org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface)

Example 2 with SchedulerHsqldbStarter

use of org.ow2.proactive.scheduler.util.SchedulerHsqldbStarter 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(), SchedulerStatus.STARTED);
    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

URI (java.net.URI)1 Credentials (org.ow2.proactive.authentication.crypto.Credentials)1 RMAuthentication (org.ow2.proactive.resourcemanager.authentication.RMAuthentication)1 ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)1 SchedulerAuthenticationInterface (org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface)1 SchedulerHsqldbStarter (org.ow2.proactive.scheduler.util.SchedulerHsqldbStarter)1