Search in sources :

Example 6 with SchedulerStatus

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

the class SchedulerClient method getStatus.

@Override
public SchedulerStatus getStatus() throws NotConnectedException, PermissionException {
    SchedulerStatus status = null;
    try {
        SchedulerStatusData schedulerStatus = restApi().getSchedulerStatus(sid);
        status = SchedulerStatus.valueOf(schedulerStatus.name());
    } catch (Exception e) {
        throwNCEOrPE(e);
    }
    return status;
}
Also used : SchedulerStatus(org.ow2.proactive.scheduler.common.SchedulerStatus) KeyStoreException(java.security.KeyStoreException) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) KeyManagementException(java.security.KeyManagementException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) JobCreationException(org.ow2.proactive.scheduler.common.exception.JobCreationException) PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) UnknownTaskException(org.ow2.proactive.scheduler.common.exception.UnknownTaskException) IOException(java.io.IOException) SchedulerException(org.ow2.proactive.scheduler.common.exception.SchedulerException) TimeoutException(java.util.concurrent.TimeoutException) JobAlreadyFinishedException(org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException) SubmissionClosedException(org.ow2.proactive.scheduler.common.exception.SubmissionClosedException) SignalApiException(org.ow2.proactive.scheduler.signal.SignalApiException)

Example 7 with SchedulerStatus

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

the class TestKillWhenInStoppedState method test.

public void test(SchedulerStatus status) throws Exception {
    System.out.println("Testing status: " + status);
    Scheduler scheduler = schedulerHelper.getSchedulerInterface();
    Assert.assertEquals("Unexpected status", SchedulerStatus.STARTED, scheduler.getStatus());
    JobId runningJobId = scheduler.submit(createRunningJob());
    JobId pendingJobId = scheduler.submit(createPendingJob());
    System.out.println("Waiting when task is running");
    schedulerHelper.waitForEventTaskRunning(runningJobId, TASK_NAME1);
    switch(status) {
        case FROZEN:
            System.out.println("Freezing scheduler");
            if (!scheduler.freeze()) {
                Assert.fail("Failed to freeze scheduler");
            }
            break;
        case PAUSED:
            System.out.println("Pausing scheduler");
            if (!scheduler.pause()) {
                Assert.fail("Failed to pause scheduler");
            }
            break;
        case STOPPED:
            System.out.println("Stopping scheduler");
            if (!scheduler.stop()) {
                Assert.fail("Failed to stop scheduler");
            }
            break;
        default:
            throw new IllegalArgumentException();
    }
    Assert.assertEquals("Unexpected status", status, scheduler.getStatus());
    System.out.println("Killing task");
    if (!scheduler.killTask(runningJobId, TASK_NAME1)) {
        Assert.fail("Failed to kill task");
    }
    schedulerHelper.waitForEventTaskFinished(runningJobId, TASK_NAME1);
    System.out.println("Killing running job");
    if (!scheduler.killJob(runningJobId)) {
        Assert.fail("Failed to kill running job");
    }
    System.out.println("Waiting for job finished event");
    schedulerHelper.waitForEventJobFinished(runningJobId, FINISH_JOB_TIMEOUT);
    System.out.println("Killing pending job");
    if (!scheduler.killJob(pendingJobId)) {
        Assert.fail("Failed to kill pending job");
    }
    System.out.println("Waiting for job finished event");
    schedulerHelper.waitForEventPendingJobFinished(pendingJobId, FINISH_JOB_TIMEOUT);
    printJobResult(scheduler, runningJobId);
    printJobResult(scheduler, pendingJobId);
}
Also used : Scheduler(org.ow2.proactive.scheduler.common.Scheduler) JobId(org.ow2.proactive.scheduler.common.job.JobId)

Example 8 with SchedulerStatus

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

the class SchedulerFactory method startLocal.

/**
 * Creates and starts a Scheduler on the local host.
 * This call considered that the JVM is correctly configured for starting Scheduler.
 * The "pa.scheduler.home" and required JVM properties MUST be set.
 *
 * @param rmURL the URL of a started Resource Manager
 * @param policy the full class name of the Scheduling policy to use.
 *
 * @return a Scheduler authentication that allow you to administer the Scheduler or get its connection URL.
 *
 * @throws ActiveObjectCreationException If Scheduler cannot be created
 */
public static SchedulerAuthenticationInterface startLocal(URI rmURL, String policy, SchedulerStatus initialStatus) throws Exception {
    SchedulerInitializer init = new SchedulerInitializer();
    init.setPolicyFullClassName(policy);
    allowNullInit = true;
    SchedulerAuthenticationInterface sai = startLocal(rmURL, init, initialStatus);
    allowNullInit = false;
    return sai;
}
Also used : SchedulerAuthenticationInterface(org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface)

Example 9 with SchedulerStatus

use of org.ow2.proactive.scheduler.common.SchedulerStatus 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)

Aggregations

SchedulerAuthenticationInterface (org.ow2.proactive.scheduler.common.SchedulerAuthenticationInterface)3 SchedulerException (org.ow2.proactive.scheduler.common.exception.SchedulerException)3 LoginException (javax.security.auth.login.LoginException)2 Test (org.junit.Test)2 ActiveObjectCreationException (org.objectweb.proactive.ActiveObjectCreationException)2 RMException (org.ow2.proactive.resourcemanager.exception.RMException)2 SchedulerStatus (org.ow2.proactive.scheduler.common.SchedulerStatus)2 InternalSchedulerException (org.ow2.proactive.scheduler.common.exception.InternalSchedulerException)2 JobId (org.ow2.proactive.scheduler.common.job.JobId)2 AdminSchedulerException (org.ow2.proactive.scheduler.exception.AdminSchedulerException)2 IOException (java.io.IOException)1 KeyManagementException (java.security.KeyManagementException)1 KeyStoreException (java.security.KeyStoreException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 PublicKey (java.security.PublicKey)1 HashMap (java.util.HashMap)1 Vector (java.util.Vector)1 ExecutorService (java.util.concurrent.ExecutorService)1 TimeoutException (java.util.concurrent.TimeoutException)1 JMXConnector (javax.management.remote.JMXConnector)1