Search in sources :

Example 1 with SchedulerConnection

use of org.ow2.proactive.scheduler.common.SchedulerConnection in project scheduling by ow2-proactive.

the class SchedulerFactory method createScheduler.

/**
 * Create a new scheduler on the local host plugged on the given resource manager.<br>
 * This will provide a connection interface to allow the access to a restricted number of user.<br>
 * Use {@link SchedulerConnection} class to join the Scheduler.
 *
 * @param rmURL the resource manager URL on which the scheduler will connect
 * @param policyFullClassName the full policy class name for the scheduler.
 * @throws AdminSchedulerException If an error occurred during creation process
 */
public static void createScheduler(URI rmURL, String policyFullClassName) throws AdminSchedulerException {
    logger.debug("Starting new Scheduler");
    // check arguments...
    if (rmURL == null) {
        String msg = "The Resource Manager URL must not be null";
        logger.error(msg);
        throw new AdminSchedulerException(msg);
    }
    try {
        // creating the scheduler
        // if this fails then it will not continue.
        logger.debug("Creating scheduler frontend...");
        PAActiveObject.newActive(SchedulerFrontend.class.getName(), new Object[] { rmURL, policyFullClassName });
        // ready
        logger.debug("Scheduler is now ready to be started!");
        ServerJobAndTaskLogs.configure();
    } catch (Exception e) {
        logger.error(e);
        e.printStackTrace();
        throw new AdminSchedulerException(e.getMessage());
    }
}
Also used : AdminSchedulerException(org.ow2.proactive.scheduler.exception.AdminSchedulerException) SchedulerFrontend(org.ow2.proactive.scheduler.core.SchedulerFrontend) LoginException(javax.security.auth.login.LoginException) ActiveObjectCreationException(org.objectweb.proactive.ActiveObjectCreationException) AdminSchedulerException(org.ow2.proactive.scheduler.exception.AdminSchedulerException) InternalSchedulerException(org.ow2.proactive.scheduler.common.exception.InternalSchedulerException) SchedulerException(org.ow2.proactive.scheduler.common.exception.SchedulerException) RMException(org.ow2.proactive.resourcemanager.exception.RMException)

Example 2 with SchedulerConnection

use of org.ow2.proactive.scheduler.common.SchedulerConnection in project scheduling by ow2-proactive.

the class SchedulerFactory method createScheduler.

/**
 * Create a new scheduler on the local host plugged on the given resource manager.<br>
 * This will provide a connection interface to allow the access to a restricted number of user.<br>
 * Use {@link SchedulerConnection} class to join the Scheduler.
 *
 * @param rmURL the resource manager URL on which the scheduler will connect
 * @param policyFullClassName the full policy class name for the scheduler.
 * @throws AdminSchedulerException If an error occurred during creation process
 */
public static void createScheduler(URI rmURL, String policyFullClassName, SchedulerStatus initialStatus) throws AdminSchedulerException {
    logger.debug("Starting new Scheduler");
    // check arguments...
    if (rmURL == null) {
        String msg = "The Resource Manager URL must not be null";
        logger.error(msg);
        throw new AdminSchedulerException(msg);
    }
    try {
        // creating the scheduler
        // if this fails then it will not continue.
        logger.debug("Creating scheduler frontend...");
        PAActiveObject.newActive(SchedulerFrontend.class, new Object[] { rmURL, policyFullClassName, initialStatus });
        // ready
        logger.debug("Scheduler is now ready to be started!");
        ServerJobAndTaskLogs.getInstance().configure();
    } catch (Exception e) {
        logger.fatal(e);
        e.printStackTrace();
        throw new AdminSchedulerException(e.getMessage());
    }
}
Also used : AdminSchedulerException(org.ow2.proactive.scheduler.exception.AdminSchedulerException) LoginException(javax.security.auth.login.LoginException) ActiveObjectCreationException(org.objectweb.proactive.ActiveObjectCreationException) AdminSchedulerException(org.ow2.proactive.scheduler.exception.AdminSchedulerException) InternalSchedulerException(org.ow2.proactive.scheduler.common.exception.InternalSchedulerException) SchedulerException(org.ow2.proactive.scheduler.common.exception.SchedulerException) RMException(org.ow2.proactive.resourcemanager.exception.RMException)

Example 3 with SchedulerConnection

use of org.ow2.proactive.scheduler.common.SchedulerConnection in project scheduling by ow2-proactive.

the class SubmitJob method begin.

public void begin() {
    // non blocking method to use futur management
    try {
        // connect the Scheduler
        // get the authentication interface using the SchedulerConnection
        SchedulerAuthenticationInterface auth = SchedulerConnection.waitAndJoin(SchedulerTHelper.getLocalUrl());
        // get the user interface using the retrieved SchedulerAuthenticationInterface
        user = auth.login(Credentials.createCredentials(new CredData(TestUsers.DEMO.username, TestUsers.DEMO.password), auth.getPublicKey()));
        // let the client be notified of its own 'job termination' -> job running to finished event
        user.addEventListener((SubmitJob) PAActiveObject.getStubOnThis(), true, SchedulerEvent.TASK_RUNNING_TO_FINISHED, SchedulerEvent.JOB_RUNNING_TO_FINISHED, SchedulerEvent.JOB_PENDING_TO_FINISHED);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : CredData(org.ow2.proactive.authentication.crypto.CredData) SchedulerAuthenticationInterface(org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface)

Aggregations

LoginException (javax.security.auth.login.LoginException)2 ActiveObjectCreationException (org.objectweb.proactive.ActiveObjectCreationException)2 RMException (org.ow2.proactive.resourcemanager.exception.RMException)2 InternalSchedulerException (org.ow2.proactive.scheduler.common.exception.InternalSchedulerException)2 SchedulerException (org.ow2.proactive.scheduler.common.exception.SchedulerException)2 AdminSchedulerException (org.ow2.proactive.scheduler.exception.AdminSchedulerException)2 CredData (org.ow2.proactive.authentication.crypto.CredData)1 SchedulerAuthenticationInterface (org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface)1 SchedulerFrontend (org.ow2.proactive.scheduler.core.SchedulerFrontend)1