use of org.ow2.proactive_grid_cloud_portal.common.SchedulerRestInterface in project scheduling by ow2-proactive.
the class PauseJobCommand method execute.
@Override
public void execute(ApplicationContext currentContext) throws CLIException {
SchedulerRestInterface scheduler = currentContext.getRestClient().getScheduler();
try {
boolean success = scheduler.pauseJob(currentContext.getSessionId(), jobId);
resultStack(currentContext).push(success);
if (success) {
writeLine(currentContext, "%s successfully paused.", job());
} else {
writeLine(currentContext, "Cannot pause %s.", job());
}
} catch (Exception e) {
handleError(String.format("An error occurred while attempting to pause %s:", job()), e, currentContext);
}
}
use of org.ow2.proactive_grid_cloud_portal.common.SchedulerRestInterface in project scheduling by ow2-proactive.
the class PreemptTaskCommand method execute.
@Override
public void execute(ApplicationContext currentContext) throws CLIException {
SchedulerRestInterface scheduler = currentContext.getRestClient().getScheduler();
try {
boolean success = scheduler.preemptTask(currentContext.getSessionId(), jobId, taskId);
resultStack(currentContext).push(success);
if (success) {
writeLine(currentContext, "%s has been stopped and will be rescheduled after 5 seconds.", task());
} else {
writeLine(currentContext, "%s cannot be stopped and most likely it is not running.", task());
}
} catch (Exception e) {
handleError(String.format("An error occurred while attempting to preemt %s:", task()), e, currentContext);
}
}
use of org.ow2.proactive_grid_cloud_portal.common.SchedulerRestInterface in project scheduling by ow2-proactive.
the class RemoveJobCommand method execute.
@Override
public void execute(ApplicationContext currentContext) throws CLIException {
SchedulerRestInterface scheduler = currentContext.getRestClient().getScheduler();
try {
boolean success = scheduler.removeJob(currentContext.getSessionId(), jobId);
resultStack(currentContext).push(success);
if (success) {
writeLine(currentContext, "%s sucessfully removed.", job());
} else {
writeLine(currentContext, "Cannot remove %s.", job());
}
} catch (Exception e) {
handleError(String.format("An error occurred while attempting to remove %s:", job()), e, currentContext);
}
}
use of org.ow2.proactive_grid_cloud_portal.common.SchedulerRestInterface in project scheduling by ow2-proactive.
the class RestartAllInErrorTasksCommand method execute.
@Override
public void execute(ApplicationContext currentContext) throws CLIException {
SchedulerRestInterface scheduler = currentContext.getRestClient().getScheduler();
try {
boolean result = scheduler.restartAllInErrorTasks(currentContext.getSessionId(), jobId);
handleResult(currentContext, result);
} catch (Exception e) {
handleError(String.format("An error occurred while attempting to restart all In-Error tasks for %s:", job()), e, currentContext);
}
}
use of org.ow2.proactive_grid_cloud_portal.common.SchedulerRestInterface in project scheduling by ow2-proactive.
the class ResumeAllPausedTasksAndRestartAllInErrorTasksCommand method execute.
@Override
public void execute(ApplicationContext currentContext) throws CLIException {
SchedulerRestInterface scheduler = currentContext.getRestClient().getScheduler();
try {
String sessionId = currentContext.getSessionId();
boolean result = scheduler.resumeJob(sessionId, jobId);
result &= scheduler.restartAllInErrorTasks(sessionId, jobId);
handleResult(currentContext, result);
} catch (Exception e) {
handleError(String.format("An error occurred while attempting to resume/restart all paused/in-error tasks for %s:", job()), e, currentContext);
}
}
Aggregations