Search in sources :

Example 11 with JobInfoImpl

use of org.ow2.proactive.scheduler.rest.data.JobInfoImpl in project scheduling by ow2-proactive.

the class TerminateReplicateTaskHandlerTest method init.

@Before
public void init() {
    action = new FlowAction(FlowActionType.REPLICATE);
    action.setDupNumber(0);
    MockitoAnnotations.initMocks(this);
    when(internalJob.getJobInfo()).thenReturn(jobInfoImpl);
    when(internalJob.getJobDescriptor()).thenReturn(jobDescriptorImpl);
    terminateReplicateTaskHandler = new TerminateReplicateTaskHandler(internalJob);
}
Also used : FlowAction(org.ow2.proactive.scheduler.common.task.flow.FlowAction) Before(org.junit.Before)

Example 12 with JobInfoImpl

use of org.ow2.proactive.scheduler.rest.data.JobInfoImpl 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 13 with JobInfoImpl

use of org.ow2.proactive.scheduler.rest.data.JobInfoImpl 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 14 with JobInfoImpl

use of org.ow2.proactive.scheduler.rest.data.JobInfoImpl 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 15 with JobInfoImpl

use of org.ow2.proactive.scheduler.rest.data.JobInfoImpl in project scheduling by ow2-proactive.

the class SchedulerStateRestJobTaskResultTest method testValueOfJobResult.

@Test
public void testValueOfJobResult() throws Throwable {
    TaskResultImpl taskResult = new TaskResultImpl(TaskIdImpl.createTaskId(JobIdImpl.makeJobId("42"), "mytask", 1), ObjectToByteConverter.ObjectStream.convert("hello"), null, null, false);
    JobResultImpl jobResultWithValue = new JobResultImpl();
    JobInfoImpl jobInfo = new JobInfoImpl();
    jobInfo.setJobId(new JobIdImpl(12, "myjob"));
    jobResultWithValue.setJobInfo(jobInfo);
    jobResultWithValue.addTaskResult("mytask", taskResult, false);
    when(mockOfScheduler.getJobResult("42")).thenReturn(jobResultWithValue);
    JobResultData jobResultData = restInterface.jobResult(sessionId, "42");
    TaskResultData taskResultData = jobResultData.getAllResults().get("mytask");
    assertNotNull(taskResultData);
    assertNotNull(taskResultData.getValue());
    assertEquals("hello", taskResultData.getValue());
    Map<String, String> jobResult = restInterface.jobResultValue(sessionId, "42");
    String result = jobResult.get("mytask");
    assertNotNull(result);
    assertEquals("hello", result);
}
Also used : JobResultImpl(org.ow2.proactive.scheduler.job.JobResultImpl) JobResultData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobResultData) TaskResultImpl(org.ow2.proactive.scheduler.task.TaskResultImpl) TaskResultData(org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskResultData) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) JobInfoImpl(org.ow2.proactive.scheduler.job.JobInfoImpl) Test(org.junit.Test)

Aggregations

JobInfoImpl (org.ow2.proactive.scheduler.job.JobInfoImpl)11 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)9 TaskInfoImpl (org.ow2.proactive.scheduler.task.TaskInfoImpl)8 JobInfo (org.ow2.proactive.scheduler.common.job.JobInfo)6 ArrayList (java.util.ArrayList)5 TaskInfo (org.ow2.proactive.scheduler.common.task.TaskInfo)4 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)4 JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)4 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)4 JobId (org.ow2.proactive.scheduler.common.job.JobId)3 HashMap (java.util.HashMap)2 Test (org.junit.Test)2 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)2 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 InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)2 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)2 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1