Search in sources :

Example 61 with TaskState

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;
    }
}
Also used : UnknownTaskException(org.ow2.proactive.scheduler.common.exception.UnknownTaskException) TaskId(org.ow2.proactive.scheduler.common.task.TaskId) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) JobState(org.ow2.proactive.scheduler.common.job.JobState) ClientJobState(org.ow2.proactive.scheduler.job.ClientJobState) TaskState(org.ow2.proactive.scheduler.common.task.TaskState)

Aggregations

TaskState (org.ow2.proactive.scheduler.common.task.TaskState)54 JobState (org.ow2.proactive.scheduler.common.job.JobState)23 ArrayList (java.util.ArrayList)15 Test (org.junit.Test)14 Scheduler (org.ow2.proactive.scheduler.common.Scheduler)13 TaskStateData (org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskStateData)13 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)12 NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)11 PermissionException (org.ow2.proactive.scheduler.common.exception.PermissionException)11 JobId (org.ow2.proactive.scheduler.common.job.JobId)10 NotConnectedRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException)10 PermissionRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException)10 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)9 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)9 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)8 TaskStatesPage (org.ow2.proactive.scheduler.common.task.TaskStatesPage)8 UnknownJobRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.UnknownJobRestException)8 GET (javax.ws.rs.GET)7 Path (javax.ws.rs.Path)7 Produces (javax.ws.rs.Produces)7