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());
}
}
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;
}
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());
}
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;
}
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));
}
Aggregations