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