use of org.ow2.proactive.scheduler.common.exception.InternalSchedulerException in project scheduling by ow2-proactive.
the class SchedulerProxyUserInterface method init.
/**
* initialize the connection the scheduler.
* Must be called only once.
* Create the corresponding credential object before sending it
* to the scheduler.
* @param url the scheduler's url
* @param credData the credential object that contains user-related data
* @throws SchedulerException thrown if the scheduler is not available
* @throws LoginException if the couple username/password is invalid
* @since Scheduling 3.1.0
*/
public void init(String url, CredData credData) throws SchedulerException, LoginException {
SchedulerAuthenticationInterface auth = SchedulerConnection.join(url);
PublicKey pubKey = auth.getPublicKey();
try {
Credentials cred = Credentials.createCredentials(credData, pubKey);
this.uischeduler = auth.login(cred);
mbeaninfoviewer = new MBeanInfoViewer(auth, credData.getLogin(), cred);
} catch (KeyException e) {
throw new InternalSchedulerException(e);
}
}
use of org.ow2.proactive.scheduler.common.exception.InternalSchedulerException in project scheduling by ow2-proactive.
the class SchedulerStarter method startScheduler.
private static SchedulerAuthenticationInterface startScheduler(CommandLine commandLine, String rmUrl) throws URISyntaxException, InternalSchedulerException, ParseException, SocketException, UnknownHostException, IllegalArgumentException {
String policyFullName = getPolicyFullName(commandLine);
LOGGER.info("Scheduler version is " + getSchedulerVersion());
LOGGER.info("Starting the scheduler...");
SchedulerAuthenticationInterface sai = null;
try {
sai = SchedulerFactory.startLocal(new URI(rmUrl), policyFullName);
startDiscovery(commandLine, rmUrl);
LOGGER.info("The scheduler created on " + sai.getHostURL());
} catch (Exception e) {
e.printStackTrace();
}
return sai;
}
use of org.ow2.proactive.scheduler.common.exception.InternalSchedulerException in project scheduling by ow2-proactive.
the class SmartProxyImpl method init.
private void init(String url, Credentials credentials, CredData credData) throws SchedulerException, LoginException {
if (this.connectionInfo == null) {
this.connectionInfo = new ConnectionInfo(url, null, null, null, false);
}
this.connectionInfo.setUrl(url);
this.credentials = credentials;
this.credData = credData;
SchedulerAuthenticationInterface auth = SchedulerConnection.join(url);
PublicKey pubKey = auth.getPublicKey();
if (this.credentials != null) {
this.credentials = credentials;
this.credData = null;
} else if (this.credData != null) {
this.credData = credData;
try {
this.credentials = Credentials.createCredentials(credData, pubKey);
} catch (KeyException e) {
throw new InternalSchedulerException(e);
}
} else {
throw new IllegalStateException("No valid credential available to connect to the scheduler");
}
this.schedulerProxy = auth.login(this.credentials);
jobTracker.loadJobs();
setInitialized(true);
registerAsListener();
syncAwaitedJobs();
}
use of org.ow2.proactive.scheduler.common.exception.InternalSchedulerException in project scheduling by ow2-proactive.
the class SchedulerFactory method startLocal.
/**
* Creates and starts a Scheduler on the local host using the given initializer to configure it.
* Only one Scheduler can be started by JVM.
*
* @param rmURL the URL of a started Resource Manager
* @param initializer Use to configure the Scheduler before starting it.
* This parameter cannot be null.
*
* @return a Scheduler authentication that allow you to administer it or get its connection URL.
*
* @throws InternalSchedulerException If Scheduler cannot be created
*/
public static synchronized SchedulerAuthenticationInterface startLocal(URI rmURL, SchedulerInitializer initializer) throws InternalSchedulerException {
if (!schedulerStarted) {
if (!allowNullInit) {
if (initializer != null) {
// configure application
configure(initializer);
} else {
throw new IllegalArgumentException("Initializer cannot be null!");
}
}
if (rmURL == null) {
throw new IllegalArgumentException("RM url is null!");
}
try {
String policy = initializer.getPolicyFullClassName();
// start scheduler
createScheduler(rmURL, policy);
SchedulerAuthenticationInterface sai = SchedulerConnection.waitAndJoin(null);
schedulerStarted = true;
return sai;
} catch (Exception e) {
throw new InternalSchedulerException(e);
}
} else {
throw new InternalSchedulerException("Scheduler already localy running");
}
}
Aggregations