use of org.ow2.proactive.scheduler.job.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);
}
use of org.ow2.proactive.scheduler.job.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());
}
}
use of org.ow2.proactive.scheduler.job.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;
}
use of org.ow2.proactive.scheduler.job.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());
}
use of org.ow2.proactive.scheduler.job.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);
}
Aggregations