Search in sources :

Example 6 with JobResultImpl

use of org.ow2.proactive.scheduler.job.JobResultImpl in project scheduling by ow2-proactive.

the class SchedulerDBManager method loadJobResult.

@SuppressWarnings("unchecked")
private JobResultImpl loadJobResult(Session session, Query query, JobData job, JobId jobId) {
    JobResultImpl jobResult = new JobResultImpl();
    jobResult.setJobInfo(job.createJobInfo(jobId));
    DBTaskId currentTaskId = null;
    List<Object[]> resultList = (List<Object[]>) query.list();
    if (resultList.isEmpty()) {
        return jobResult;
    }
    int counter = 0;
    for (Object[] result : resultList) {
        TaskResultData resultData = (TaskResultData) result[0];
        DBTaskId dbTaskId = (DBTaskId) result[1];
        String taskName = (String) result[2];
        Boolean preciousResult = (Boolean) result[3];
        boolean nextTask = !dbTaskId.equals(currentTaskId);
        if (nextTask) {
            TaskId taskId = TaskIdImpl.createTaskId(jobId, taskName, dbTaskId.getTaskId());
            jobResult.addTaskResult(taskName, resultData.toTaskResult(taskId), preciousResult);
            currentTaskId = dbTaskId;
        }
        if (++counter % 100 == 0) {
            session.clear();
        }
    }
    return jobResult;
}
Also used : JobResultImpl(org.ow2.proactive.scheduler.job.JobResultImpl) DBTaskId(org.ow2.proactive.scheduler.core.db.TaskData.DBTaskId) TaskId(org.ow2.proactive.scheduler.common.task.TaskId) DBTaskId(org.ow2.proactive.scheduler.core.db.TaskData.DBTaskId) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

JobResultImpl (org.ow2.proactive.scheduler.job.JobResultImpl)6 Test (org.junit.Test)4 TaskResultImpl (org.ow2.proactive.scheduler.task.TaskResultImpl)3 ArrayList (java.util.ArrayList)1 List (java.util.List)1 SimpleTaskLogs (org.ow2.proactive.scheduler.common.task.SimpleTaskLogs)1 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)1 DBTaskId (org.ow2.proactive.scheduler.core.db.TaskData.DBTaskId)1 JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)1 JobInfoImpl (org.ow2.proactive.scheduler.job.JobInfoImpl)1 JobResultData (org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobResultData)1 TaskResultData (org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskResultData)1