public FifoSchedulerInfo(ResourceManager rm) { // JAXB needs this RMContext rmContext = rm.GetRMContext(); FifoScheduler fs = (FifoScheduler)rm.GetResourceScheduler(); qName = fs.GetQueueInfo(string.Empty, false, false).GetQueueName(); QueueInfo qInfo = fs.GetQueueInfo(qName, true, true); this.usedCapacity = qInfo.GetCurrentCapacity(); this.capacity = qInfo.GetCapacity(); this.minQueueMemoryCapacity = fs.GetMinimumResourceCapability().GetMemory(); this.maxQueueMemoryCapacity = fs.GetMaximumResourceCapability().GetMemory(); this.qstate = qInfo.GetQueueState(); this.numNodes = rmContext.GetRMNodes().Count; this.usedNodeCapacity = 0; this.availNodeCapacity = 0; this.totalNodeCapacity = 0; this.numContainers = 0; foreach (RMNode ni in rmContext.GetRMNodes().Values) { SchedulerNodeReport report = fs.GetNodeReport(ni.GetNodeID()); this.usedNodeCapacity += report.GetUsedResource().GetMemory(); this.availNodeCapacity += report.GetAvailableResource().GetMemory(); this.totalNodeCapacity += ni.GetTotalCapability().GetMemory(); this.numContainers += fs.GetNodeReport(ni.GetNodeID()).GetNumContainers(); } }
public static IList <RMNode> QueryRMNodes(RMContext context, EnumSet <NodeState> acceptedStates ) { // nodes contains nodes that are NEW, RUNNING OR UNHEALTHY AList <RMNode> results = new AList <RMNode>(); if (acceptedStates.Contains(NodeState.New) || acceptedStates.Contains(NodeState.Running ) || acceptedStates.Contains(NodeState.Unhealthy)) { foreach (RMNode rmNode in context.GetRMNodes().Values) { if (acceptedStates.Contains(rmNode.GetState())) { results.AddItem(rmNode); } } } // inactiveNodes contains nodes that are DECOMMISSIONED, LOST, OR REBOOTED if (acceptedStates.Contains(NodeState.Decommissioned) || acceptedStates.Contains( NodeState.Lost) || acceptedStates.Contains(NodeState.Rebooted)) { foreach (RMNode rmNode in context.GetInactiveRMNodes().Values) { if (acceptedStates.Contains(rmNode.GetState())) { results.AddItem(rmNode); } } } return(results); }
public virtual void TestRMNMInfoMissmatch() { RMContext rmc = Org.Mockito.Mockito.Mock <RMContext>(); ResourceScheduler rms = Org.Mockito.Mockito.Mock <ResourceScheduler>(); ConcurrentMap <NodeId, RMNode> map = new ConcurrentHashMap <NodeId, RMNode>(); RMNode node = MockNodes.NewNodeInfo(1, MockNodes.NewResource(4 * 1024)); map[node.GetNodeID()] = node; Org.Mockito.Mockito.When(rmc.GetRMNodes()).ThenReturn(map); RMNMInfo rmInfo = new RMNMInfo(rmc, rms); string liveNMs = rmInfo.GetLiveNodeManagers(); ObjectMapper mapper = new ObjectMapper(); JsonNode jn = mapper.ReadTree(liveNMs); NUnit.Framework.Assert.AreEqual("Unexpected number of live nodes:", 1, jn.Size()); IEnumerator <JsonNode> it = jn.GetEnumerator(); while (it.HasNext()) { JsonNode n = it.Next(); NUnit.Framework.Assert.IsNotNull(n.Get("HostName")); NUnit.Framework.Assert.IsNotNull(n.Get("Rack")); NUnit.Framework.Assert.IsTrue("Node " + n.Get("NodeId") + " should be RUNNING", n .Get("State").AsText().Contains("RUNNING")); NUnit.Framework.Assert.IsNotNull(n.Get("NodeHTTPAddress")); NUnit.Framework.Assert.IsNotNull(n.Get("LastHealthUpdate")); NUnit.Framework.Assert.IsNotNull(n.Get("HealthReport")); NUnit.Framework.Assert.IsNotNull(n.Get("NodeManagerVersion")); NUnit.Framework.Assert.IsNull(n.Get("NumContainers")); NUnit.Framework.Assert.IsNull(n.Get("UsedMemoryMB")); NUnit.Framework.Assert.IsNull(n.Get("AvailableMemoryMB")); } }
/// <exception cref="System.IO.IOException"/> /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/> public virtual void RefreshNodes(Configuration yarnConf) { lock (hostsReader) { if (null == yarnConf) { yarnConf = new YarnConfiguration(); } includesFile = yarnConf.Get(YarnConfiguration.RmNodesIncludeFilePath, YarnConfiguration .DefaultRmNodesIncludeFilePath); excludesFile = yarnConf.Get(YarnConfiguration.RmNodesExcludeFilePath, YarnConfiguration .DefaultRmNodesExcludeFilePath); hostsReader.UpdateFileNames(includesFile, excludesFile); hostsReader.Refresh(includesFile.IsEmpty() ? null : this.rmContext.GetConfigurationProvider ().GetConfigurationInputStream(this.conf, includesFile), excludesFile.IsEmpty() ? null : this.rmContext.GetConfigurationProvider().GetConfigurationInputStream(this .conf, excludesFile)); PrintConfiguredHosts(); } foreach (NodeId nodeId in rmContext.GetRMNodes().Keys) { if (!IsValidNode(nodeId.GetHost())) { this.rmContext.GetDispatcher().GetEventHandler().Handle(new RMNodeEvent(nodeId, RMNodeEventType .Decommission)); } } }