use of org.ow2.proactive.scheduler.task.TaskInfoImpl in project scheduling by ow2-proactive.
the class DozerMappingTest method createJobState.
private JobState createJobState() {
return new ClientJobState(new JobState() {
@Override
public void update(TaskInfo taskInfo) {
}
@Override
public void update(JobInfo jobInfo) {
}
@Override
public JobInfo getJobInfo() {
return new JobInfoImpl();
}
@Override
public ArrayList<TaskState> getTasks() {
return new ArrayList<>(getHMTasks().values());
}
@Override
public Map<TaskId, TaskState> getHMTasks() {
TaskId taskId = TaskIdImpl.createTaskId(new JobIdImpl(42, "job"), "remoteVisuTask", 1);
TaskState value = new ClientTaskState(new TaskState() {
@Override
public void update(TaskInfo taskInfo) {
}
@Override
public List<TaskState> getDependences() {
return null;
}
@Override
public TaskInfo getTaskInfo() {
TaskInfoImpl taskInfo = new TaskInfoImpl();
taskInfo.setTaskId(TaskIdImpl.createTaskId(new JobIdImpl(42, "job"), "remoteVisuTask", 1));
return taskInfo;
}
@Override
public int getMaxNumberOfExecutionOnFailure() {
return 0;
}
@Override
public TaskState replicate() throws Exception {
return null;
}
@Override
public int getIterationIndex() {
return 0;
}
@Override
public int getReplicationIndex() {
return 0;
}
});
return Collections.singletonMap(taskId, value);
}
@Override
public String getOwner() {
return null;
}
@Override
public JobType getType() {
return null;
}
});
}
use of org.ow2.proactive.scheduler.task.TaskInfoImpl in project scheduling by ow2-proactive.
the class ClientJobStateTest method createJobState.
private JobState createJobState(final JobInfoImpl jobInfo) {
return new JobState() {
@Override
public void update(TaskInfo info) {
}
@Override
public void update(JobInfo jobInfo) {
}
@Override
public JobInfo getJobInfo() {
return jobInfo;
}
@Override
public List<TaskState> getTasks() {
List<TaskState> tasks = new ArrayList<>(0);
tasks.add(new TaskState() {
@Override
public void update(TaskInfo taskInfo) {
}
@Override
public List<TaskState> getDependences() {
return null;
}
@Override
public TaskInfo getTaskInfo() {
TaskInfoImpl taskInfo = new TaskInfoImpl();
taskInfo.setJobInfo(jobInfo);
taskInfo.setTaskId(TaskIdImpl.createTaskId(jobInfo.getJobId(), "task", 1));
return taskInfo;
}
@Override
public int getMaxNumberOfExecutionOnFailure() {
return 0;
}
@Override
public TaskState replicate() throws Exception {
return null;
}
@Override
public int getIterationIndex() {
return 0;
}
@Override
public int getReplicationIndex() {
return 0;
}
});
return tasks;
}
@Override
public Map<TaskId, TaskState> getHMTasks() {
return null;
}
@Override
public String getOwner() {
return null;
}
@Override
public JobType getType() {
return null;
}
};
}
use of org.ow2.proactive.scheduler.task.TaskInfoImpl in project scheduling by ow2-proactive.
the class LiveJobs method restartTaskOnNodeFailure.
private void restartTaskOnNodeFailure(InternalTask task, JobData jobData, TerminationData terminationData) {
final String errorMsg = "An error has occurred due to a node failure and the maximum amount of retries property has been reached.";
task.setProgress(0);
task.decreaseNumberOfExecutionOnFailureLeft();
tlogger.info(task.getId(), "number of retry on failure left " + task.getNumberOfExecutionOnFailureLeft());
InternalJob job = jobData.job;
if (task.getNumberOfExecutionOnFailureLeft() > 0) {
task.setStatus(TaskStatus.WAITING_ON_FAILURE);
job.newWaitingTask();
listener.taskStateUpdated(job.getOwner(), new NotificationData<TaskInfo>(SchedulerEvent.TASK_WAITING_FOR_RESTART, new TaskInfoImpl((TaskInfoImpl) task.getTaskInfo())));
job.reStartTask(task);
dbManager.taskRestarted(job, task, null);
tlogger.info(task.getId(), " is waiting for restart");
} else {
job.incrementNumberOfFailedTasksBy(1);
endJob(jobData, terminationData, task, null, errorMsg, JobStatus.FAILED);
}
}
use of org.ow2.proactive.scheduler.task.TaskInfoImpl in project scheduling by ow2-proactive.
the class LiveJobs method updateTasksInSchedulerState.
private void updateTasksInSchedulerState(InternalJob job, Set<TaskId> tasksToUpdate) {
for (TaskId tid : tasksToUpdate) {
try {
InternalTask t = job.getTask(tid);
TaskInfo ti = new TaskInfoImpl((TaskInfoImpl) t.getTaskInfo());
listener.taskStateUpdated(job.getOwner(), new NotificationData<>(SchedulerEvent.TASK_RUNNING_TO_FINISHED, ti));
} catch (UnknownTaskException e) {
logger.error(e);
}
}
}
use of org.ow2.proactive.scheduler.task.TaskInfoImpl in project scheduling by ow2-proactive.
the class InternalJob method update.
@Override
public synchronized 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 = (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);
}
}
}
}
Aggregations