コード例 #1
0
ファイル: NodeInfo.cs プロジェクト: orf53975/hadoop.net
        public NodeInfo(RMNode ni, ResourceScheduler sched)
        {
            // JAXB needs this
            NodeId id = ni.GetNodeID();
            SchedulerNodeReport report = sched.GetNodeReport(id);

            this.numContainers = 0;
            this.usedMemoryMB  = 0;
            this.availMemoryMB = 0;
            if (report != null)
            {
                this.numContainers         = report.GetNumContainers();
                this.usedMemoryMB          = report.GetUsedResource().GetMemory();
                this.availMemoryMB         = report.GetAvailableResource().GetMemory();
                this.usedVirtualCores      = report.GetUsedResource().GetVirtualCores();
                this.availableVirtualCores = report.GetAvailableResource().GetVirtualCores();
            }
            this.id               = id.ToString();
            this.rack             = ni.GetRackName();
            this.nodeHostName     = ni.GetHostName();
            this.state            = ni.GetState();
            this.nodeHTTPAddress  = ni.GetHttpAddress();
            this.lastHealthUpdate = ni.GetLastHealthReportTime();
            this.healthReport     = ni.GetHealthReport().ToString();
            this.version          = ni.GetNodeManagerVersion();
            // add labels
            ICollection <string> labelSet = ni.GetNodeLabels();

            if (labelSet != null)
            {
                Sharpen.Collections.AddAll(nodeLabels, labelSet);
                nodeLabels.Sort();
            }
        }
コード例 #2
0
ファイル: RMNMInfo.cs プロジェクト: orf53975/hadoop.net
        /// <summary>Implements getLiveNodeManagers()</summary>
        /// <returns>JSON formatted string containing statuses of all node managers</returns>
        public virtual string GetLiveNodeManagers()
        {
            // RMNMInfoBeans
            ICollection <RMNode>     nodes     = this.rmContext.GetRMNodes().Values;
            IList <RMNMInfo.InfoMap> nodesInfo = new AList <RMNMInfo.InfoMap>();

            foreach (RMNode ni in nodes)
            {
                SchedulerNodeReport report = scheduler.GetNodeReport(ni.GetNodeID());
                RMNMInfo.InfoMap    info   = new RMNMInfo.InfoMap();
                info["HostName"]           = ni.GetHostName();
                info["Rack"]               = ni.GetRackName();
                info["State"]              = ni.GetState().ToString();
                info["NodeId"]             = ni.GetNodeID();
                info["NodeHTTPAddress"]    = ni.GetHttpAddress();
                info["LastHealthUpdate"]   = ni.GetLastHealthReportTime();
                info["HealthReport"]       = ni.GetHealthReport();
                info["NodeManagerVersion"] = ni.GetNodeManagerVersion();
                if (report != null)
                {
                    info["NumContainers"]     = report.GetNumContainers();
                    info["UsedMemoryMB"]      = report.GetUsedResource().GetMemory();
                    info["AvailableMemoryMB"] = report.GetAvailableResource().GetMemory();
                }
                nodesInfo.AddItem(info);
            }
            return(JSON.ToString(nodesInfo));
        }
コード例 #3
0
        /// <exception cref="Org.Codehaus.Jettison.Json.JSONException"/>
        /// <exception cref="System.Exception"/>
        public virtual void VerifyNodeInfoGeneric(MockNM nm, string state, string rack, string
                                                  id, string nodeHostName, string nodeHTTPAddress, long lastHealthUpdate, string
                                                  healthReport, int numContainers, long usedMemoryMB, long availMemoryMB, long usedVirtualCores
                                                  , long availVirtualCores, string version)
        {
            RMNode              node   = rm.GetRMContext().GetRMNodes()[nm.GetNodeId()];
            ResourceScheduler   sched  = rm.GetResourceScheduler();
            SchedulerNodeReport report = sched.GetNodeReport(nm.GetNodeId());

            WebServicesTestUtils.CheckStringMatch("state", node.GetState().ToString(), state);
            WebServicesTestUtils.CheckStringMatch("rack", node.GetRackName(), rack);
            WebServicesTestUtils.CheckStringMatch("id", nm.GetNodeId().ToString(), id);
            WebServicesTestUtils.CheckStringMatch("nodeHostName", nm.GetNodeId().GetHost(), nodeHostName
                                                  );
            WebServicesTestUtils.CheckStringMatch("healthReport", node.GetHealthReport().ToString
                                                      (), healthReport);
            string expectedHttpAddress = nm.GetNodeId().GetHost() + ":" + nm.GetHttpPort();

            WebServicesTestUtils.CheckStringMatch("nodeHTTPAddress", expectedHttpAddress, nodeHTTPAddress
                                                  );
            WebServicesTestUtils.CheckStringMatch("version", node.GetNodeManagerVersion(), version
                                                  );
            long expectedHealthUpdate = node.GetLastHealthReportTime();

            NUnit.Framework.Assert.AreEqual("lastHealthUpdate doesn't match, got: " + lastHealthUpdate
                                            + " expected: " + expectedHealthUpdate, expectedHealthUpdate, lastHealthUpdate);
            if (report != null)
            {
                NUnit.Framework.Assert.AreEqual("numContainers doesn't match: " + numContainers,
                                                report.GetNumContainers(), numContainers);
                NUnit.Framework.Assert.AreEqual("usedMemoryMB doesn't match: " + usedMemoryMB, report
                                                .GetUsedResource().GetMemory(), usedMemoryMB);
                NUnit.Framework.Assert.AreEqual("availMemoryMB doesn't match: " + availMemoryMB,
                                                report.GetAvailableResource().GetMemory(), availMemoryMB);
                NUnit.Framework.Assert.AreEqual("usedVirtualCores doesn't match: " + usedVirtualCores
                                                , report.GetUsedResource().GetVirtualCores(), usedVirtualCores);
                NUnit.Framework.Assert.AreEqual("availVirtualCores doesn't match: " + availVirtualCores
                                                , report.GetAvailableResource().GetVirtualCores(), availVirtualCores);
            }
        }