Search in sources :

Example 1 with NodeStatus

use of alluxio.hub.agent.util.process.NodeStatus in project alluxio by Alluxio.

the class AgentProcessContext method heartbeat.

private void heartbeat() {
    try {
        NodeStatus ps = new NodeStatus();
        List<AlluxioProcessStatus> alluxioStatus = mProcs.keySet().stream().map(t -> {
            try {
                return ps.getProcessStatus(t);
            } catch (IOException e) {
                LogUtils.warnWithException(LOG, "Failed to get process status for {}", t, e);
                return AlluxioProcessStatus.newBuilder().setNodeType(t).setState(ProcessState.UNKNOWN).setPid(-1).build();
            }
        }).collect(Collectors.toList());
        AlluxioNodeStatus s = AlluxioNodeStatus.newBuilder().setHostname(NetworkAddressUtils.getConnectHost(NetworkAddressUtils.ServiceType.HUB_AGENT_RPC, mConf)).addAllProcess(alluxioStatus).build();
        AgentHeartbeatRequest request = AgentHeartbeatRequest.newBuilder().setHubNode(getNodeAddress()).setAlluxioStatus(s).build();
        mClient.get().agentHeartbeat(request);
    } catch (Throwable t) {
        LogUtils.warnWithException(LOG, "Failed to send agent heartbeat", t);
    }
}
Also used : Arrays(java.util.Arrays) ScheduledFuture(java.util.concurrent.ScheduledFuture) AlluxioConfigurationSet(alluxio.hub.proto.AlluxioConfigurationSet) AlluxioProcessStatus(alluxio.hub.proto.AlluxioProcessStatus) LoggerFactory(org.slf4j.LoggerFactory) TimeoutException(java.util.concurrent.TimeoutException) PropertyKey(alluxio.conf.PropertyKey) LogUtils(alluxio.util.LogUtils) AgentListFileInfo(alluxio.hub.proto.AgentListFileInfo) ByteArrayInputStream(java.io.ByteArrayInputStream) Duration(java.time.Duration) Map(java.util.Map) FileManager(alluxio.hub.agent.util.file.FileManager) Path(java.nio.file.Path) ProcessState(alluxio.hub.proto.ProcessState) UploadProcessType(alluxio.hub.proto.UploadProcessType) ConfigurationEditor(alluxio.hub.agent.util.conf.ConfigurationEditor) RpcClient(alluxio.hub.common.RpcClient) ManagerAgentServiceGrpc(alluxio.hub.proto.ManagerAgentServiceGrpc) Set(java.util.Set) AgentHeartbeatRequest(alluxio.hub.proto.AgentHeartbeatRequest) ExponentialTimeBoundedRetry(alluxio.retry.ExponentialTimeBoundedRetry) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) ThreadSafe(javax.annotation.concurrent.ThreadSafe) InetSocketAddress(java.net.InetSocketAddress) Collectors(java.util.stream.Collectors) AlluxioNodeStatus(alluxio.hub.proto.AlluxioNodeStatus) ByteString(com.google.protobuf.ByteString) Objects(java.util.Objects) List(java.util.List) PrestoCatalogUtils.getProcessInfo(alluxio.hub.agent.util.file.PrestoCatalogUtils.getProcessInfo) ExponentialBackoffRetry(alluxio.retry.ExponentialBackoffRetry) HashMap(java.util.HashMap) NetworkAddressUtils(alluxio.util.network.NetworkAddressUtils) AlluxioNodeType(alluxio.hub.proto.AlluxioNodeType) PathUtils(alluxio.util.io.PathUtils) HubNodeAddress(alluxio.hub.proto.HubNodeAddress) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) AlluxioConfiguration(alluxio.conf.AlluxioConfiguration) NodeStatus(alluxio.hub.agent.util.process.NodeStatus) RetryPolicy(alluxio.retry.RetryPolicy) SimpleFileManager(alluxio.hub.agent.util.file.SimpleFileManager) RegisterAgentRequest(alluxio.hub.proto.RegisterAgentRequest) Logger(org.slf4j.Logger) Properties(java.util.Properties) Files(java.nio.file.Files) StringWriter(java.io.StringWriter) IOException(java.io.IOException) ThreadFactoryUtils(alluxio.util.ThreadFactoryUtils) Pair(alluxio.collections.Pair) ConfigurationUtils(alluxio.util.ConfigurationUtils) ProcessStateChange(alluxio.hub.proto.ProcessStateChange) TimeUnit(java.util.concurrent.TimeUnit) PrestoCatalogUtils(alluxio.hub.agent.util.file.PrestoCatalogUtils) ProcessLauncher(alluxio.hub.agent.util.process.ProcessLauncher) Paths(java.nio.file.Paths) Preconditions(com.google.common.base.Preconditions) Collections(java.util.Collections) AlluxioProcessStatus(alluxio.hub.proto.AlluxioProcessStatus) AgentHeartbeatRequest(alluxio.hub.proto.AgentHeartbeatRequest) AlluxioNodeStatus(alluxio.hub.proto.AlluxioNodeStatus) IOException(java.io.IOException) AlluxioNodeStatus(alluxio.hub.proto.AlluxioNodeStatus) NodeStatus(alluxio.hub.agent.util.process.NodeStatus)

Aggregations

Pair (alluxio.collections.Pair)1 AlluxioConfiguration (alluxio.conf.AlluxioConfiguration)1 PropertyKey (alluxio.conf.PropertyKey)1 ConfigurationEditor (alluxio.hub.agent.util.conf.ConfigurationEditor)1 FileManager (alluxio.hub.agent.util.file.FileManager)1 PrestoCatalogUtils (alluxio.hub.agent.util.file.PrestoCatalogUtils)1 PrestoCatalogUtils.getProcessInfo (alluxio.hub.agent.util.file.PrestoCatalogUtils.getProcessInfo)1 SimpleFileManager (alluxio.hub.agent.util.file.SimpleFileManager)1 NodeStatus (alluxio.hub.agent.util.process.NodeStatus)1 ProcessLauncher (alluxio.hub.agent.util.process.ProcessLauncher)1 RpcClient (alluxio.hub.common.RpcClient)1 AgentHeartbeatRequest (alluxio.hub.proto.AgentHeartbeatRequest)1 AgentListFileInfo (alluxio.hub.proto.AgentListFileInfo)1 AlluxioConfigurationSet (alluxio.hub.proto.AlluxioConfigurationSet)1 AlluxioNodeStatus (alluxio.hub.proto.AlluxioNodeStatus)1 AlluxioNodeType (alluxio.hub.proto.AlluxioNodeType)1 AlluxioProcessStatus (alluxio.hub.proto.AlluxioProcessStatus)1 HubNodeAddress (alluxio.hub.proto.HubNodeAddress)1 ManagerAgentServiceGrpc (alluxio.hub.proto.ManagerAgentServiceGrpc)1 ProcessState (alluxio.hub.proto.ProcessState)1