use of org.ow2.proactive.scheduler.common.exception.SchedulerException 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.SchedulerException in project scheduling by ow2-proactive.
the class JobResultSchedulerListener method jobRunningToFinishedEvent.
private void jobRunningToFinishedEvent(NotificationData<JobInfo> jobNotification) {
JobId jobId = jobNotification.getData().getJobId();
logger.trace("Trying to get the job result for job " + jobId);
try {
logger.info("The result for job with ID " + jobId + " is " + this.daddy.getJobResult(jobId));
} catch (SchedulerException e) {
logger.error("Cannot get the job result for job with id " + jobId + " from the scheduler", e);
}
}
use of org.ow2.proactive.scheduler.common.exception.SchedulerException in project scheduling by ow2-proactive.
the class SchedulerAuthenticationGUIHelper method login.
/**
* This method will log a client to the scheduler by requesting his URL, username and password from a
* graphical interface.
*
* @param schedulerURL The default URL of the scheduler to connect
* @return The connection to the scheduler as a {@link Scheduler} if logging successful.
* If the username is empty or if the user cancel the authentication, this method will return null.
* @throws LoginException If a problem occurs while logging the user.
* @throws SchedulerException If a problem occurs at scheduler level.
*/
public static Scheduler login(String schedulerURL) throws LoginException, SchedulerException {
AuthResultContainer auth = connect(schedulerURL);
if (auth == null) {
return null;
} else {
SchedulerAuthenticationInterface schedAuth = auth.getAuth();
Credentials cred = null;
try {
cred = Credentials.createCredentials(new CredData(CredData.parseLogin(auth.getUsername()), CredData.parseDomain(auth.getUsername()), auth.getPassword()), schedAuth.getPublicKey());
} catch (LoginException e) {
throw new LoginException("Could not retrieve public key from Scheduler " + schedulerURL + ", contact the administrator" + e);
} catch (KeyException e) {
throw new LoginException("Could not encrypt credentials " + e);
}
return schedAuth.login(cred);
}
}
use of org.ow2.proactive.scheduler.common.exception.SchedulerException 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);
}
use of org.ow2.proactive.scheduler.common.exception.SchedulerException in project scheduling by ow2-proactive.
the class SharedSessionStoreTestUtils method createValidSession.
public static String createValidSession(SchedulerProxyUserInterface scheduler) throws LoginException, ActiveObjectCreationException, SchedulerException, NodeException {
SchedulerRMProxyFactory schedulerFactory = mock(SchedulerRMProxyFactory.class);
when(schedulerFactory.connectToScheduler(Matchers.<CredData>any())).thenReturn(scheduler);
SharedSessionStore.getInstance().setSchedulerRMProxyFactory(schedulerFactory);
// login
Session session = SharedSessionStore.getInstance().createUnnamedSession();
session.connectToScheduler(new CredData());
return session.getSessionId();
}
Aggregations