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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations