use of org.ow2.proactive.scheduler.common.Scheduler in project scheduling by ow2-proactive.
the class TaskLauncher method sendResultToScheduler.
private void sendResultToScheduler(TaskTerminateNotification terminateNotification, TaskResultImpl taskResult) {
if (isNodeShuttingDown()) {
return;
}
int pingAttempts = initializer.getPingAttempts();
int pingPeriodMs = initializer.getPingPeriod() * 1000;
// We are going to contact the recipient of the task result. This
// recipient is the TaskTerminateNotification, an active object on the
// scheduler side. If the scheduler experienced a transient failure
// while the task was computing, then the reference to this
// TaskTerminateNotification is obsolete and we need to update it. This
// is what the following code does.
TaskTerminateNotification currentTerminateNotification = terminateNotification;
for (int i = 0; i < pingAttempts; i++) {
try {
currentTerminateNotification.terminate(taskId, taskResult);
logger.debug("Successfully notified task termination " + taskId);
// termination has succeeded, exit the method
return;
} catch (Throwable t) {
logger.warn("Cannot notify task termination, trying to rebind to the task termination handler");
TaskTerminateNotification rebindedTerminateNotification = taskLauncherRebinder.getReboundTaskTerminateNotificationHandler(t);
if (rebindedTerminateNotification != null) {
currentTerminateNotification = rebindedTerminateNotification;
} else {
decreasePingAttemptsAndWait(pingAttempts, pingPeriodMs, i, t);
}
}
}
logger.error("Cannot notify task termination " + taskId + " after " + pingAttempts + " attempts, terminating task launcher now");
}
use of org.ow2.proactive.scheduler.common.Scheduler in project scheduling by ow2-proactive.
the class SchedulerNodeClient method connect.
/**
* Connects to the scheduler at the specified schedulerRestUrl, using the current user credentials
* @param url schedulerRestUrl of the scheduler
* @throws Exception
*/
public void connect(String url) throws Exception {
CredData userCreds = decrypter.decrypt();
client = SchedulerClient.createInstance();
client.init(new ConnectionInfo(url, userCreds.getLogin(), userCreds.getPassword(), null, true));
}
use of org.ow2.proactive.scheduler.common.Scheduler in project scheduling by ow2-proactive.
the class SchedulerProxyUserInterface method init.
/**
* initialize the connection the scheduler.
* Must be called only once
* @param url the scheduler's url
* @param credentials the credential to be passed to the scheduler
* @throws SchedulerException thrown if the scheduler is not available
* @throws LoginException thrown if the credential is invalid
*/
public void init(String url, Credentials credentials) throws SchedulerException, LoginException {
SchedulerAuthenticationInterface auth = SchedulerConnection.join(url);
this.uischeduler = auth.login(credentials);
mbeaninfoviewer = new MBeanInfoViewer(auth, null, credentials);
}
use of org.ow2.proactive.scheduler.common.Scheduler 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.Scheduler 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 user the username to use
* @param pwd the password to use
* @throws SchedulerException thrown if the scheduler is not available
* @throws LoginException if the couple username/password is invalid
*/
public void init(String url, String user, String pwd) throws SchedulerException, LoginException {
CredData cred = new CredData(CredData.parseLogin(user), CredData.parseDomain(user), pwd);
init(url, cred);
}
Aggregations