Search in sources :

Example 1 with AdminSchedulerException

use of org.ow2.proactive.scheduler.exception.AdminSchedulerException 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 AdminSchedulerException

use of org.ow2.proactive.scheduler.exception.AdminSchedulerException 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 constructor also requires the credentials of the client to connect.<br><br>
 * It will return a client scheduler able to managed the scheduler.<br><br>
 * <font color="red">WARNING :</font> this method provides a way to connect to the scheduler after its creation,
 * BUT if the scheduler is restarting after failure, this method will create the scheduler
 * but will throw a SchedulerException due to the failure of client connection.<br>
 * In fact, while the scheduler is restarting after a crash, no one can connect it during the whole restore process.<br><br>
 * In any other case, the method will block until connection is allowed or error occurred.
 *
 * @param rmURL the resource manager URL on which the scheduler will connect
 * @param policyFullClassName the full policy class name for the scheduler.
 * @return a scheduler interface to manage the scheduler.
 * @throws SchedulerException if the scheduler cannot be created.
 * @throws AdminSchedulerException if a client connection exception occurs.
 * @throws LoginException if a user login/password exception occurs.
 */
public static Scheduler createScheduler(Credentials creds, URI rmURL, String policyFullClassName) throws AdminSchedulerException, SchedulerException, LoginException {
    createScheduler(rmURL, policyFullClassName);
    SchedulerAuthenticationInterface auth = SchedulerConnection.waitAndJoin(null);
    return auth.login(creds);
}
Also used : SchedulerAuthenticationInterface(org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface)

Aggregations

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