use of org.ow2.proactive.scheduler.common.task.TaskInfo 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.common.task.TaskInfo in project scheduling by ow2-proactive.
the class SchedulerClient method getTaskIds.
@Override
public Page<TaskId> getTaskIds(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit) throws NotConnectedException, PermissionException {
RestPage<TaskStateData> page = null;
try {
page = restApi().getTaskStates(sid, from, to, mytasks, running, pending, finished, offset, limit, null);
} catch (NotConnectedRestException e) {
throw new NotConnectedException(e);
} catch (PermissionRestException e) {
throw new PermissionException(e);
}
List<TaskId> lTaskIds = new ArrayList<TaskId>(page.getList().size());
for (TaskStateData taskStateData : page.getList()) {
TaskInfoData taskInfo = taskStateData.getTaskInfo();
TaskIdData taskIdData = taskInfo.getTaskId();
JobId jobId = new JobIdImpl(taskInfo.getJobId().getId(), taskInfo.getJobId().getReadableName());
TaskId taskId = TaskIdImpl.createTaskId(jobId, taskIdData.getReadableName(), taskIdData.getId());
lTaskIds.add(taskId);
}
return new Page<TaskId>(lTaskIds, page.getSize());
}
use of org.ow2.proactive.scheduler.common.task.TaskInfo in project scheduling by ow2-proactive.
the class SchedulerEventBroadcaster method taskStateUpdatedEvent.
@Override
public void taskStateUpdatedEvent(NotificationData<TaskInfo> notification) {
logEvent(notification);
TaskInfoData taskInfoData = dozerMapper.map(notification.getData(), TaskInfoData.class);
broadcast(new EventNotification(EventNotification.Action.TASK_STATE_UPDATED, eventTypeName(notification), taskInfoData));
}
use of org.ow2.proactive.scheduler.common.task.TaskInfo 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.common.task.TaskInfo 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);
}
}
Aggregations