Search in sources :

Example 11 with TaskInfoImpl

use of org.ow2.proactive.scheduler.task.TaskInfoImpl in project scheduling by ow2-proactive.

the class ClientJobState method update.

@Override
public void update(JobInfo info) {
    if (!getId().equals(info.getJobId())) {
        throw new IllegalArgumentException("This job info is not applicable for this job. (expected id is '" + getId() + "' but was '" + info.getJobId() + "'");
    }
    // update job info
    this.jobInfo = new JobInfoImpl((JobInfoImpl) info);
    // update skipped tasks
    if (this.jobInfo.getTasksSkipped() != null) {
        for (TaskId id : tasks.keySet()) {
            if (this.jobInfo.getTasksSkipped().contains(id)) {
                TaskInfoImpl taskInfo = (TaskInfoImpl) tasks.get(id).getTaskInfo();
                taskInfo.setStatus(TaskStatus.SKIPPED);
            }
        }
    }
    // additions and modifications can be caused by control flow actions
    if (this.jobInfo.getModifiedTasks() != null) {
        addTasks(this.jobInfo.getModifiedTasks());
    }
}
Also used : TaskId(org.ow2.proactive.scheduler.common.task.TaskId) TaskInfoImpl(org.ow2.proactive.scheduler.task.TaskInfoImpl)

Example 12 with TaskInfoImpl

use of org.ow2.proactive.scheduler.task.TaskInfoImpl in project scheduling by ow2-proactive.

the class ClientJobStateTest method createTaskInfo.

private TaskInfoImpl createTaskInfo(JobInfoImpl jobInfo) {
    TaskInfoImpl updatedTask = new TaskInfoImpl();
    updatedTask.setJobInfo(jobInfo);
    updatedTask.setTaskId(TaskIdImpl.createTaskId(jobInfo.getJobId(), "task", 1));
    return updatedTask;
}
Also used : TaskInfoImpl(org.ow2.proactive.scheduler.task.TaskInfoImpl)

Example 13 with TaskInfoImpl

use of org.ow2.proactive.scheduler.task.TaskInfoImpl in project scheduling by ow2-proactive.

the class ClientJobStateTest method testNumberOfTasksInJobInfoUpdatedWhenUpdateTask.

@Test
public void testNumberOfTasksInJobInfoUpdatedWhenUpdateTask() throws Exception {
    JobInfoImpl jobInfo = createJobInfo();
    ClientJobState jobState = new ClientJobState(createJobState(jobInfo));
    jobInfo.setNumberOfFinishedTasks(3);
    jobInfo.setNumberOfPendingTasks(2);
    jobInfo.setNumberOfRunningTasks(1);
    TaskInfoImpl updatedTask = createTaskInfo(jobInfo);
    jobState.update(updatedTask);
    assertEquals(1, jobState.getJobInfo().getNumberOfRunningTasks());
    assertEquals(2, jobState.getJobInfo().getNumberOfPendingTasks());
    assertEquals(3, jobState.getJobInfo().getNumberOfFinishedTasks());
}
Also used : TaskInfoImpl(org.ow2.proactive.scheduler.task.TaskInfoImpl) Test(org.junit.Test)

Example 14 with TaskInfoImpl

use of org.ow2.proactive.scheduler.task.TaskInfoImpl in project scheduling by ow2-proactive.

the class DataUtility method taskInfo.

public static TaskInfo taskInfo(TaskInfoData d) {
    TaskInfoImpl impl = new TaskInfoImpl();
    JobIdData jobIdData = d.getJobId();
    if (jobIdData != null) {
        JobId jobId = jobId(jobIdData);
        impl.setJobId(jobId);
        TaskId taskId = taskId(jobId, d.getTaskId());
        impl.setTaskId(taskId);
    }
    impl.setExecutionDuration(d.getExecutionDuration());
    impl.setExecutionHostName(d.getExecutionHostName());
    impl.setInErrorTime(d.getInErrorTime());
    impl.setFinishedTime(d.getFinishedTime());
    impl.setNumberOfExecutionLeft(d.getNumberOfExecutionLeft());
    impl.setNumberOfExecutionOnFailureLeft(d.getNumberOfExecutionOnFailureLeft());
    impl.setStartTime(d.getStartTime());
    impl.setStatus(TaskStatus.valueOf(d.getTaskStatus().name()));
    impl.setName(d.getTaskId().getReadableName());
    impl.setProgress(d.getProgress());
    return impl;
}
Also used : TaskId(org.ow2.proactive.scheduler.common.task.TaskId) TaskIdImpl.createTaskId(org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId)

Example 15 with TaskInfoImpl

use of org.ow2.proactive.scheduler.task.TaskInfoImpl in project scheduling by ow2-proactive.

the class LiveJobsTest method testTaskTerminatedWithResultSuspendTaskOnError.

@Test(timeout = 60000)
public void testTaskTerminatedWithResultSuspendTaskOnError() throws UnknownTaskException {
    InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
    JobId id = new JobIdImpl(666L, "test-name");
    job.setId(id);
    List<InternalTask> tasksList = new ArrayList<>();
    InternalTask internalTask = new InternalScriptTask(job);
    TaskId taskId = TaskIdImpl.createTaskId(id, "task-name", 0L);
    internalTask.setId(taskId);
    internalTask.setName("task-name");
    internalTask.setStatus(TaskStatus.RUNNING);
    internalTask.setExecuterInformation(Mockito.mock(ExecuterInformation.class));
    TaskInfoImpl taskInfoImpl = (TaskInfoImpl) internalTask.getTaskInfo();
    taskInfoImpl.setNumberOfExecutionLeft(2);
    internalTask.setOnTaskError(OnTaskError.PAUSE_TASK);
    tasksList.add(internalTask);
    job.setTasks(tasksList);
    liveJobs.jobSubmitted(job);
    liveJobs.lockJobsToSchedule();
    liveJobs.taskStarted(job, job.getTask("task-name"), null);
    TaskResultImpl result = new TaskResultImpl(taskId, new Exception(), null, 330);
    liveJobs.taskTerminatedWithResult(taskId, result);
    assertThat(taskInfoImpl.getNumberOfExecutionLeft(), is(1));
    assertThat(taskInfoImpl.getStatus(), is(TaskStatus.WAITING_ON_ERROR));
    assertThat(job.getStatus(), is(JobStatus.STALLED));
}
Also used : ExecuterInformation(org.ow2.proactive.scheduler.task.internal.ExecuterInformation) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) TaskId(org.ow2.proactive.scheduler.common.task.TaskId) TaskResultImpl(org.ow2.proactive.scheduler.task.TaskResultImpl) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) ArrayList(java.util.ArrayList) TaskInfoImpl(org.ow2.proactive.scheduler.task.TaskInfoImpl) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) UnknownTaskException(org.ow2.proactive.scheduler.common.exception.UnknownTaskException) InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) InternalTaskFlowJob(org.ow2.proactive.scheduler.job.InternalTaskFlowJob) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Aggregations

TaskInfoImpl (org.ow2.proactive.scheduler.task.TaskInfoImpl)21 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)15 TaskInfo (org.ow2.proactive.scheduler.common.task.TaskInfo)9 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)9 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)9 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)8 ArrayList (java.util.ArrayList)7 JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)7 Test (org.junit.Test)6 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)6 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)6 JobId (org.ow2.proactive.scheduler.common.job.JobId)5 InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)5 ExecuterInformation (org.ow2.proactive.scheduler.task.internal.ExecuterInformation)5 InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)5 JobInfo (org.ow2.proactive.scheduler.common.job.JobInfo)4 JobInfoImpl (org.ow2.proactive.scheduler.job.JobInfoImpl)3 JobState (org.ow2.proactive.scheduler.common.job.JobState)2 TaskState (org.ow2.proactive.scheduler.common.task.TaskState)2 ChangedTasksInfo (org.ow2.proactive.scheduler.job.ChangedTasksInfo)2