Search in sources :

Example 1 with JobInfo

use of alluxio.grpc.JobInfo in project alluxio by Alluxio.

the class CommandHandlingExecutor method heartbeat.

@Override
public void heartbeat() {
    mHealthReporter.compute();
    if (mHealthReporter.isHealthy()) {
        mTaskExecutorManager.unthrottle();
    } else {
        mTaskExecutorManager.throttle();
    }
    JobWorkerHealth jobWorkerHealth = new JobWorkerHealth(JobWorkerIdRegistry.getWorkerId(), mHealthReporter.getCpuLoadAverage(), mTaskExecutorManager.getTaskExecutorPoolSize(), mTaskExecutorManager.getNumActiveTasks(), mTaskExecutorManager.unfinishedTasks(), mWorkerNetAddress.getHost());
    List<TaskInfo> taskStatusList = mTaskExecutorManager.getAndClearTaskUpdates();
    List<alluxio.grpc.JobCommand> commands;
    List<JobInfo> taskProtoList = taskStatusList.stream().map(TaskInfo::toProto).collect(Collectors.toList());
    try {
        commands = mMasterClient.heartbeat(jobWorkerHealth, taskProtoList);
    } catch (AlluxioException | IOException e) {
        // Restore the task updates so that they can be accessed in the next heartbeat.
        mTaskExecutorManager.restoreTaskUpdates(taskStatusList);
        // TODO(yupeng) better error handling
        LOG.error("Failed to heartbeat", e);
        return;
    }
    for (JobCommand command : commands) {
        mCommandHandlingService.execute(new CommandHandler(command));
    }
}
Also used : TaskInfo(alluxio.job.wire.TaskInfo) JobInfo(alluxio.grpc.JobInfo) JobCommand(alluxio.grpc.JobCommand) JobWorkerHealth(alluxio.job.wire.JobWorkerHealth) IOException(java.io.IOException) AlluxioException(alluxio.exception.AlluxioException)

Aggregations

AlluxioException (alluxio.exception.AlluxioException)1 JobCommand (alluxio.grpc.JobCommand)1 JobInfo (alluxio.grpc.JobInfo)1 JobWorkerHealth (alluxio.job.wire.JobWorkerHealth)1 TaskInfo (alluxio.job.wire.TaskInfo)1 IOException (java.io.IOException)1