use of org.ow2.proactive.scheduler.common.task.TaskId in project scheduling by ow2-proactive.
the class GetTaskResultCommand method execute.
@Override
public void execute(ApplicationContext currentContext) throws CLIException {
SchedulerRestInterface scheduler = currentContext.getRestClient().getScheduler();
try {
TaskResultData taskResult = scheduler.taskResult(currentContext.getSessionId(), jobId, taskId);
resultStack(currentContext).push(taskResult);
if (!currentContext.isSilent()) {
writeLine(currentContext, "%s", StringUtility.taskResultAsString(task(), taskResult));
}
} catch (Exception e) {
handleError(String.format("An error occurred while retrieving %s result:", task()), e, currentContext);
}
}
use of org.ow2.proactive.scheduler.common.task.TaskId in project scheduling by ow2-proactive.
the class RestartInErrorTaskCommand method execute.
@Override
public void execute(ApplicationContext currentContext) throws CLIException {
SchedulerRestInterface scheduler = currentContext.getRestClient().getScheduler();
try {
boolean result = scheduler.restartInErrorTask(currentContext.getSessionId(), jobId, taskId);
handleResult(currentContext, result);
} catch (Exception e) {
handleError(String.format("An error occurred while attempting to restart %s:", task()), e, currentContext);
}
}
use of org.ow2.proactive.scheduler.common.task.TaskId in project scheduling by ow2-proactive.
the class RestartRunningTaskCommand method execute.
@Override
public void execute(ApplicationContext currentContext) throws CLIException {
SchedulerRestInterface scheduler = currentContext.getRestClient().getScheduler();
try {
boolean result = scheduler.restartTask(currentContext.getSessionId(), jobId, taskId);
handleResult(currentContext, result);
} catch (Exception e) {
handleError(String.format("An error occurred while attempting to restart %s:", task()), e, currentContext);
}
}
use of org.ow2.proactive.scheduler.common.task.TaskId in project scheduling by ow2-proactive.
the class RestartTaskCommand method execute.
@Override
public void execute(ApplicationContext currentContext) throws CLIException {
SchedulerRestInterface scheduler = currentContext.getRestClient().getScheduler();
try {
boolean result = scheduler.restartTask(currentContext.getSessionId(), jobId, taskId);
handleResult(currentContext, result);
} catch (Exception e) {
handleError(String.format("An error occurred while attempting to restart %s:", task()), e, currentContext);
}
}
use of org.ow2.proactive.scheduler.common.task.TaskId in project scheduling by ow2-proactive.
the class SchedulerClient method getTaskIds.
@Override
public Page<TaskId> getTaskIds(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit) throws NotConnectedException, PermissionException {
RestPage<TaskStateData> page = null;
try {
page = restApi().getTaskStates(sid, from, to, mytasks, running, pending, finished, offset, limit, null);
} catch (NotConnectedRestException e) {
throw new NotConnectedException(e);
} catch (PermissionRestException e) {
throw new PermissionException(e);
}
List<TaskId> lTaskIds = new ArrayList<TaskId>(page.getList().size());
for (TaskStateData taskStateData : page.getList()) {
TaskInfoData taskInfo = taskStateData.getTaskInfo();
TaskIdData taskIdData = taskInfo.getTaskId();
JobId jobId = new JobIdImpl(taskInfo.getJobId().getId(), taskInfo.getJobId().getReadableName());
TaskId taskId = TaskIdImpl.createTaskId(jobId, taskIdData.getReadableName(), taskIdData.getId());
lTaskIds.add(taskId);
}
return new Page<TaskId>(lTaskIds, page.getSize());
}
Aggregations