Search in sources :

Example 1 with TaskInfo

use of alluxio.job.wire.TaskInfo in project alluxio by Alluxio.

the class PlanInfo method setTaskInfo.

/**
 * Sets the information of a task.
 *
 * @param taskId the task id
 * @param taskInfo the task information
 */
public void setTaskInfo(long taskId, TaskInfo taskInfo) {
    TaskInfo oldTaskInfo = mTaskIdToInfo.get(taskId);
    if (oldTaskInfo != null) {
        taskInfo.setDescription(oldTaskInfo.getDescription());
    }
    mTaskIdToInfo.put(taskId, taskInfo);
}
Also used : TaskInfo(alluxio.job.wire.TaskInfo)

Example 2 with TaskInfo

use of alluxio.job.wire.TaskInfo in project alluxio by Alluxio.

the class PlanCoordinatorTest method setTasksWithStatuses.

private void setTasksWithStatuses(PlanCoordinator planCoordinator, Status... statuses) throws Exception {
    List<TaskInfo> taskInfos = new ArrayList<>();
    int taskId = 0;
    for (Status status : statuses) {
        taskInfos.add(new TaskInfo().setTaskId(taskId++).setJobId(mJobId).setStatus(status));
    }
    planCoordinator.updateTasks(taskInfos);
}
Also used : TaskInfo(alluxio.job.wire.TaskInfo) Status(alluxio.job.wire.Status) ArrayList(java.util.ArrayList)

Example 3 with TaskInfo

use of alluxio.job.wire.TaskInfo in project alluxio by Alluxio.

the class TaskExecutorManager method executeTask.

/**
 * Executes the given task.
 *
 * @param jobId the job id
 * @param taskId the task id
 * @param runTaskCommand the run task command
 * @param context the context of the worker
 */
public synchronized void executeTask(long jobId, long taskId, RunTaskCommand runTaskCommand, RunTaskContext context) {
    Future<?> future = mTaskExecutionService.submit(new TaskExecutor(jobId, taskId, runTaskCommand, context, this));
    Pair<Long, Long> id = new Pair<>(jobId, taskId);
    mTaskFutures.put(id, future);
    TaskInfo taskInfo = new TaskInfo(jobId, taskId, Status.CREATED, mAddress, null);
    mUnfinishedTasks.put(id, taskInfo);
    mTaskUpdates.put(id, taskInfo);
    LOG.info("Task {} for job {} received", taskId, jobId);
}
Also used : TaskInfo(alluxio.job.wire.TaskInfo) Pair(alluxio.collections.Pair)

Example 4 with TaskInfo

use of alluxio.job.wire.TaskInfo in project alluxio by Alluxio.

the class TaskExecutorManager method finishTask.

private void finishTask(Pair<Long, Long> id) {
    TaskInfo taskInfo = mUnfinishedTasks.get(id);
    mTaskFutures.remove(id);
    mUnfinishedTasks.remove(id);
    mTaskUpdates.put(id, taskInfo);
}
Also used : TaskInfo(alluxio.job.wire.TaskInfo)

Example 5 with TaskInfo

use of alluxio.job.wire.TaskInfo in project alluxio by Alluxio.

the class PlanCoordinator method join.

/**
 * Joins the task results and produces a final result.
 *
 * @param taskInfoList the list of task information
 * @return the aggregated result as a String
 * @throws Exception if any error occurs
 */
private String join(List<TaskInfo> taskInfoList) throws Exception {
    // get the job definition
    PlanDefinition<JobConfig, Serializable, Serializable> definition = PlanDefinitionRegistry.INSTANCE.getJobDefinition(mPlanInfo.getJobConfig());
    Map<WorkerInfo, Serializable> taskResults = Maps.newHashMap();
    for (TaskInfo taskInfo : taskInfoList) {
        taskResults.put(mTaskIdToWorkerInfo.get(taskInfo.getTaskId()), taskInfo.getResult());
    }
    return definition.join(mPlanInfo.getJobConfig(), taskResults);
}
Also used : TaskInfo(alluxio.job.wire.TaskInfo) Serializable(java.io.Serializable) WorkerInfo(alluxio.wire.WorkerInfo) BatchedJobConfig(alluxio.job.plan.BatchedJobConfig) JobConfig(alluxio.job.JobConfig)

Aggregations

TaskInfo (alluxio.job.wire.TaskInfo)15 Pair (alluxio.collections.Pair)5 JobConfig (alluxio.job.JobConfig)2 BatchedJobConfig (alluxio.job.plan.BatchedJobConfig)2 Status (alluxio.job.wire.Status)2 ArrayList (java.util.ArrayList)2 FileSystem (alluxio.client.file.FileSystem)1 AlluxioException (alluxio.exception.AlluxioException)1 JobDoesNotExistException (alluxio.exception.JobDoesNotExistException)1 JobCommand (alluxio.grpc.JobCommand)1 JobInfo (alluxio.grpc.JobInfo)1 MasterWorkerInfo (alluxio.job.MasterWorkerInfo)1 JobInfo (alluxio.job.wire.JobInfo)1 JobWorkerHealth (alluxio.job.wire.JobWorkerHealth)1 PlanCoordinator (alluxio.master.job.plan.PlanCoordinator)1 LockResource (alluxio.resource.LockResource)1 CountingRetry (alluxio.retry.CountingRetry)1 WorkerInfo (alluxio.wire.WorkerInfo)1 IOException (java.io.IOException)1 Serializable (java.io.Serializable)1