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;
}
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);
}
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;
}
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());
}
}
Aggregations