/// <exception cref="System.IO.IOException"/> private NodeStatus GetNodeStatus(int responseId) { NodeHealthStatus nodeHealthStatus = this.context.GetNodeHealthStatus(); nodeHealthStatus.SetHealthReport(healthChecker.GetHealthReport()); nodeHealthStatus.SetIsNodeHealthy(healthChecker.IsHealthy()); nodeHealthStatus.SetLastHealthReportTime(healthChecker.GetLastHealthReportTime()); if (Log.IsDebugEnabled()) { Log.Debug("Node's health-status : " + nodeHealthStatus.GetIsNodeHealthy() + ", " + nodeHealthStatus.GetHealthReport()); } IList <ContainerStatus> containersStatuses = GetContainerStatuses(); NodeStatus nodeStatus = NodeStatus.NewInstance(nodeId, responseId, containersStatuses , CreateKeepAliveApplicationList(), nodeHealthStatus); return(nodeStatus); }
/// <exception cref="System.Exception"/> public virtual void TestResourceTrackerOnHA() { NodeId nodeId = NodeId.NewInstance("localhost", 0); Resource resource = Resource.NewInstance(2048, 4); // make sure registerNodeManager works when failover happens RegisterNodeManagerRequest request = RegisterNodeManagerRequest.NewInstance(nodeId , 0, resource, YarnVersionInfo.GetVersion(), null, null); resourceTracker.RegisterNodeManager(request); NUnit.Framework.Assert.IsTrue(WaitForNodeManagerToConnect(10000, nodeId)); // restart the failover thread, and make sure nodeHeartbeat works failoverThread = CreateAndStartFailoverThread(); NodeStatus status = NodeStatus.NewInstance(NodeId.NewInstance("localhost", 0), 0, null, null, null); NodeHeartbeatRequest request2 = NodeHeartbeatRequest.NewInstance(status, null, null ); resourceTracker.NodeHeartbeat(request2); }