Search in sources :

Example 6 with TaskInfo

use of org.ow2.proactive.scheduler.common.task.TaskInfo 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);
        }
    }
}
Also used : TaskInfo(org.ow2.proactive.scheduler.common.task.TaskInfo) UnknownTaskException(org.ow2.proactive.scheduler.common.exception.UnknownTaskException) TaskId(org.ow2.proactive.scheduler.common.task.TaskId) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) TaskInfoImpl(org.ow2.proactive.scheduler.task.TaskInfoImpl)

Example 7 with TaskInfo

use of org.ow2.proactive.scheduler.common.task.TaskInfo in project scheduling by ow2-proactive.

the class TaskData method toTaskState.

public TaskState toTaskState() {
    TaskInfo taskInfo = toTaskInfo();
    TaskStateImpl taskState = new TaskStateImpl();
    taskState.update(taskInfo);
    taskState.setName(getTaskName());
    taskState.setDescription(getDescription());
    taskState.setTag(getTag());
    taskState.setIterationIndex(getIteration());
    taskState.setReplicationIndex(getReplication());
    taskState.setMaxNumberOfExecution(getMaxNumberOfExecution());
    taskState.setParallelEnvironment(getParallelEnvironment());
    taskState.setGenericInformation(getGenericInformation());
    taskState.setVariables(variablesToTaskVariables());
    return taskState;
}
Also used : TaskInfo(org.ow2.proactive.scheduler.common.task.TaskInfo) TaskStateImpl(org.ow2.proactive.scheduler.task.TaskStateImpl)

Example 8 with TaskInfo

use of org.ow2.proactive.scheduler.common.task.TaskInfo in project scheduling by ow2-proactive.

the class TaskData method createTaskInfo.

TaskInfoImpl createTaskInfo(JobIdImpl jobId) {
    TaskId taskId = TaskIdImpl.createTaskId(jobId, getTaskName(), getId().getTaskId(), getTag());
    TaskInfoImpl taskInfo = new TaskInfoImpl();
    taskInfo.setTaskId(taskId);
    taskInfo.setStatus(getTaskStatus());
    taskInfo.setStartTime(getStartTime());
    taskInfo.setProgress(0);
    taskInfo.setInErrorTime(getInErrorTime());
    taskInfo.setNumberOfExecutionOnFailureLeft(getNumberOfExecutionOnFailureLeft());
    taskInfo.setNumberOfExecutionLeft(getNumberOfExecutionLeft());
    taskInfo.setJobInfo(getJobData().toJobInfo());
    taskInfo.setJobId(jobId);
    taskInfo.setFinishedTime(getFinishedTime());
    taskInfo.setScheduledTime(getScheduledTime());
    taskInfo.setExecutionHostName(getExecutionHostName());
    taskInfo.setExecutionDuration(getExecutionDuration());
    return taskInfo;
}
Also used : TaskId(org.ow2.proactive.scheduler.common.task.TaskId) TaskInfoImpl(org.ow2.proactive.scheduler.task.TaskInfoImpl)

Example 9 with TaskInfo

use of org.ow2.proactive.scheduler.common.task.TaskInfo 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);
            }
        }
    }
}
Also used : TaskId(org.ow2.proactive.scheduler.common.task.TaskId) TaskInfoImpl(org.ow2.proactive.scheduler.task.TaskInfoImpl)

Example 10 with TaskInfo

use of org.ow2.proactive.scheduler.common.task.TaskInfo in project scheduling by ow2-proactive.

the class SubmitJob method taskStateUpdatedEvent.

public void taskStateUpdatedEvent(NotificationData<TaskInfo> notif) {
    try {
        System.out.println("Task '" + notif.getData().getTaskId() + "' result received !!");
        TaskResult result = user.getTaskResult(notif.getData().getJobId(), notif.getData().getTaskId().getReadableName());
        terminated++;
        System.out.println("(" + terminated + ")Result value = " + result.value());
    } catch (Throwable t) {
        t.printStackTrace();
    }
}
Also used : TaskResult(org.ow2.proactive.scheduler.common.task.TaskResult)

Aggregations

TaskInfo (org.ow2.proactive.scheduler.common.task.TaskInfo)26 TaskId (org.ow2.proactive.scheduler.common.task.TaskId)15 TaskInfoImpl (org.ow2.proactive.scheduler.task.TaskInfoImpl)14 JobId (org.ow2.proactive.scheduler.common.job.JobId)10 Test (org.junit.Test)8 JobInfo (org.ow2.proactive.scheduler.common.job.JobInfo)7 JobState (org.ow2.proactive.scheduler.common.job.JobState)7 InternalTask (org.ow2.proactive.scheduler.task.internal.InternalTask)6 ArrayList (java.util.ArrayList)5 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)5 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)4 TaskStatus (org.ow2.proactive.scheduler.common.task.TaskStatus)4 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)4 JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)4 File (java.io.File)3 TaskAbortedException (org.ow2.proactive.scheduler.common.exception.TaskAbortedException)3 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)3 JobInfoImpl (org.ow2.proactive.scheduler.job.JobInfoImpl)3 TaskInfoData (org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskInfoData)3 Page (org.ow2.proactive.scheduler.common.Page)2