private NodeStatus GetNodeStatus() { NodeStatus status = recordFactory.NewRecordInstance <NodeStatus>(); status.SetContainersStatuses(new AList <ContainerStatus>()); status.SetKeepAliveApplications(new AList <ApplicationId>()); status.SetNodeHealthStatus(GetNodeHealthStatus()); status.SetNodeId(GetNodeId()); status.SetResponseId(1); return(status); }
public static NodeStatus CreateNodeStatus(NodeId nodeId, IList <ContainerStatus> containers ) { RecordFactory recordFactory = RecordFactoryProvider.GetRecordFactory(null); NodeStatus nodeStatus = recordFactory.NewRecordInstance <NodeStatus>(); nodeStatus.SetNodeId(nodeId); nodeStatus.SetContainersStatuses(containers); NodeHealthStatus nodeHealthStatus = recordFactory.NewRecordInstance <NodeHealthStatus >(); nodeHealthStatus.SetIsNodeHealthy(true); nodeStatus.SetNodeHealthStatus(nodeHealthStatus); return(nodeStatus); }
/// <exception cref="System.Exception"/> public virtual NodeHeartbeatResponse NodeHeartbeat(IDictionary <ApplicationId, IList <Org.Apache.Hadoop.Yarn.Api.Records.ContainerStatus> > conts, bool isHealthy, int resId) { NodeHeartbeatRequest req = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <NodeHeartbeatRequest >(); NodeStatus status = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <NodeStatus>(); status.SetResponseId(resId); status.SetNodeId(nodeId); foreach (KeyValuePair <ApplicationId, IList <Org.Apache.Hadoop.Yarn.Api.Records.ContainerStatus > > entry in conts) { Org.Mortbay.Log.Log.Info("entry.getValue() " + entry.Value); status.SetContainersStatuses(entry.Value); } NodeHealthStatus healthStatus = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <NodeHealthStatus >(); healthStatus.SetHealthReport(string.Empty); healthStatus.SetIsNodeHealthy(isHealthy); healthStatus.SetLastHealthReportTime(1); status.SetNodeHealthStatus(healthStatus); req.SetNodeStatus(status); req.SetLastKnownContainerTokenMasterKey(this.currentContainerTokenMasterKey); req.SetLastKnownNMTokenMasterKey(this.currentNMTokenMasterKey); NodeHeartbeatResponse heartbeatResponse = resourceTracker.NodeHeartbeat(req); MasterKey masterKeyFromRM = heartbeatResponse.GetContainerTokenMasterKey(); if (masterKeyFromRM != null && masterKeyFromRM.GetKeyId() != this.currentContainerTokenMasterKey .GetKeyId()) { this.currentContainerTokenMasterKey = masterKeyFromRM; } masterKeyFromRM = heartbeatResponse.GetNMTokenMasterKey(); if (masterKeyFromRM != null && masterKeyFromRM.GetKeyId() != this.currentNMTokenMasterKey .GetKeyId()) { this.currentNMTokenMasterKey = masterKeyFromRM; } return(heartbeatResponse); }