use of org.ow2.proactive.resourcemanager.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerClient method getJobInfo.
@Override
public JobInfo getJobInfo(String jobId) throws UnknownJobException, NotConnectedException, PermissionException {
JobInfoData jobInfoData = null;
try {
jobInfoData = restApi().jobInfo(sid, jobId);
} catch (NotConnectedRestException e) {
throw new NotConnectedException(e);
} catch (PermissionRestException e) {
throw new PermissionException(e);
} catch (UnknownJobRestException e) {
throw new UnknownJobException(e);
}
JobInfoImpl jobInfoImpl = new JobInfoImpl();
JobId newJobId = JobIdImpl.makeJobId(jobId);
jobInfoImpl.setJobId(newJobId);
jobInfoImpl.setJobOwner(jobInfoData.getJobOwner());
jobInfoImpl.setFinishedTime(jobInfoData.getFinishedTime());
jobInfoImpl.setRemovedTime(jobInfoData.getRemovedTime());
jobInfoImpl.setStartTime(jobInfoData.getStartTime());
jobInfoImpl.setInErrorTime(jobInfoData.getInErrorTime());
jobInfoImpl.setSubmittedTime(jobInfoData.getSubmittedTime());
jobInfoImpl.setNumberOfFinishedTasks(jobInfoData.getNumberOfFinishedTasks());
jobInfoImpl.setNumberOfPendingTasks(jobInfoData.getNumberOfPendingTasks());
jobInfoImpl.setNumberOfRunningTasks(jobInfoData.getNumberOfRunningTasks());
jobInfoImpl.setNumberOfInErrorTasks(jobInfoData.getNumberOfInErrorTasks());
jobInfoImpl.setNumberOfFaultyTasks(jobInfoData.getNumberOfFaultyTasks());
jobInfoImpl.setTotalNumberOfTasks(jobInfoData.getTotalNumberOfTasks());
jobInfoImpl.setJobPriority(JobPriority.findPriority(jobInfoData.getPriority().toString()));
jobInfoImpl.setJobStatus(JobStatus.findPriority(jobInfoData.getStatus().toString()));
if (jobInfoData.isToBeRemoved())
jobInfoImpl.setToBeRemoved();
jobInfoImpl.setGenericInformation(jobInfoData.getGenericInformation());
jobInfoImpl.setVariables(jobInfoData.getVariables());
return jobInfoImpl;
}
use of org.ow2.proactive.resourcemanager.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerClient method isTaskFinished.
@Override
public boolean isTaskFinished(String jobId, String taskName) throws UnknownJobException, NotConnectedException, PermissionException, UnknownTaskException {
boolean finished = false;
try {
TaskStateData taskStateData = restApi().jobTask(sid, jobId, taskName);
TaskState taskState = taskState(taskStateData);
finished = !taskState.getStatus().isTaskAlive();
} catch (Exception e) {
throwUJEOrNCEOrPEOrUTE(e);
}
return finished;
}
use of org.ow2.proactive.resourcemanager.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerClient method getTaskResultsByTag.
@Override
public List<TaskResult> getTaskResultsByTag(JobId jobId, String taskTag) throws NotConnectedException, UnknownJobException, PermissionException {
List<TaskState> taskStates = getJobState(jobId).getTasksByTag(taskTag);
ArrayList<TaskResult> results = new ArrayList<TaskResult>(taskStates.size());
for (TaskState currentState : taskStates) {
String taskName = currentState.getTaskInfo().getName();
try {
TaskResult currentResult = getTaskResult(jobId, taskName);
results.add(currentResult);
} catch (UnknownTaskException ex) {
// never occurs because tasks are filtered by tag so they cannot
// be unknown.
logger.warn("Unknown task.", ex);
}
}
return results;
}
use of org.ow2.proactive.resourcemanager.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerClient method getTaskStates.
@Override
public Page<TaskState> getTaskStates(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit, SortSpecifierContainer sortParams) throws NotConnectedException, PermissionException {
RestPage<TaskStateData> page = null;
SortSpecifierContainer sortContainer = new SortSpecifierContainer(sortParams.toString());
try {
page = restApi().getTaskStates(sid, from, to, mytasks, running, pending, finished, offset, limit, sortContainer);
} catch (NotConnectedRestException e) {
throw new NotConnectedException(e);
} catch (PermissionRestException e) {
throw new PermissionException(e);
}
List<TaskState> lTaskStates = new ArrayList<TaskState>(page.getList().size());
for (TaskStateData taskStateData : page.getList()) {
lTaskStates.add(new TaskStateImpl(taskStateData));
}
return new Page<TaskState>(lTaskStates, page.getSize());
}
use of org.ow2.proactive.resourcemanager.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerClient method getJobState.
@Override
public JobState getJobState(String jobId) throws NotConnectedException, UnknownJobException, PermissionException {
JobState jobState = null;
try {
JobStateData jobStateData = restApi().listJobs(sid, jobId);
jobState = toJobState(jobStateData);
} catch (Exception e) {
throwUJEOrNCEOrPE(e);
}
return jobState;
}
Aggregations