use of org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskInfoData 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_grid_cloud_portal.scheduler.dto.TaskInfoData 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_grid_cloud_portal.scheduler.dto.TaskInfoData in project scheduling by ow2-proactive.
the class AbstractSmartProxy method updateTask.
/**
* Check if the task concerned by this notification is awaited. Retrieve
* corresponding data if needed
*
* @param notification
*/
protected void updateTask(NotificationData<TaskInfo> notification) {
// am I interested in this task?
TaskInfo taskInfoData = notification.getData();
JobId id = taskInfoData.getJobId();
TaskId tid = taskInfoData.getTaskId();
String tname = tid.getReadableName();
TaskStatus status = taskInfoData.getStatus();
AwaitedJob aj = jobTracker.getAwaitedJob(id.toString());
if (aj == null)
return;
AwaitedTask at = aj.getAwaitedTask(tname);
if (at == null)
return;
at.setTaskId(tid.toString());
jobTracker.putAwaitedJob(id.toString(), aj);
switch(status) {
case ABORTED:
case NOT_RESTARTED:
case NOT_STARTED:
case SKIPPED:
{
log.debug("The task " + tname + " from job " + id + " couldn't start. No data will be transfered");
jobTracker.removeAwaitedTask(id.toString(), tname);
break;
}
case FINISHED:
{
log.debug("The task " + tname + " from job " + id + " is finished.");
if (aj.isAutomaticTransfer()) {
log.debug("Transferring data for finished task " + tname + " from job " + id);
try {
downloadTaskOutputFiles(aj, id.toString(), tname, aj.getLocalOutputFolder());
} catch (Throwable t) {
log.error("Error while handling data for finished task " + tname + " for job " + id + ", task will be removed");
jobTracker.removeAwaitedTask(id.toString(), tname);
}
}
break;
}
case FAILED:
case FAULTY:
{
log.debug("The task " + tname + " from job " + id + " is faulty.");
jobTracker.removeAwaitedTask(id.toString(), tname);
break;
}
}
}
use of org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskInfoData in project scheduling by ow2-proactive.
the class RestTestUtils method newMockedTaskStateData.
protected static TaskStateData newMockedTaskStateData(String jobIdStr, String tag, long cnt, int nbTasks) {
TaskStateData mockedTaskStateData = mock(TaskStateData.class);
TaskInfoData mockedTaskInfoData = mock(TaskInfoData.class);
TaskIdData mockedTaskIdData = mock(TaskIdData.class);
when(mockedTaskIdData.getReadableName()).thenReturn(generateReadableName(jobIdStr, cnt, nbTasks));
when(mockedTaskIdData.getId()).thenReturn(cnt);
when(mockedTaskInfoData.getTaskId()).thenReturn(mockedTaskIdData);
when(mockedTaskStateData.getTaskInfo()).thenReturn(mockedTaskInfoData);
when(mockedTaskStateData.getTag()).thenReturn(tag);
return mockedTaskStateData;
}
use of org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskInfoData 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;
}
Aggregations