use of org.ow2.proactive.scheduler.common.task.TaskState in project scheduling by ow2-proactive.
the class SchedulerFrontendState method getTaskState.
synchronized TaskState getTaskState(JobId jobId, String taskName) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException {
checkPermissions("getJobState", getIdentifiedJob(jobId), YOU_DO_NOT_HAVE_PERMISSION_TO_GET_THE_STATE_OF_THIS_TASK);
if (jobsMap.get(jobId) == null) {
throw new UnknownJobException(jobId);
}
TaskId taskId = null;
for (TaskId t : getJobTasks(jobId)) {
if (t.getReadableName().equals(taskName)) {
taskId = t;
}
}
if (taskId == null) {
throw new UnknownTaskException(taskName, jobId);
}
JobState jobState = jobsMap.get(jobId);
synchronized (jobState) {
TaskState ts = jobState.getHMTasks().get(taskId);
if (ts == null) {
throw new UnknownTaskException(taskId, jobId);
}
return ts;
}
}
Aggregations