public UserMetricsInfo(ResourceManager rm, string user) { // JAXB needs this ResourceScheduler rs = rm.GetResourceScheduler(); QueueMetrics metrics = rs.GetRootQueueMetrics(); QueueMetrics userMetrics = metrics.GetUserMetrics(user); this.userMetricsAvailable = false; if (userMetrics != null) { this.userMetricsAvailable = true; this.appsSubmitted = userMetrics.GetAppsSubmitted(); this.appsCompleted = userMetrics.GetAppsCompleted(); this.appsPending = userMetrics.GetAppsPending(); this.appsRunning = userMetrics.GetAppsRunning(); this.appsFailed = userMetrics.GetAppsFailed(); this.appsKilled = userMetrics.GetAppsKilled(); this.runningContainers = userMetrics.GetAllocatedContainers(); this.pendingContainers = userMetrics.GetPendingContainers(); this.reservedContainers = userMetrics.GetReservedContainers(); this.reservedMB = userMetrics.GetReservedMB(); this.pendingMB = userMetrics.GetPendingMB(); this.allocatedMB = userMetrics.GetAllocatedMB(); this.reservedVirtualCores = userMetrics.GetReservedVirtualCores(); this.pendingVirtualCores = userMetrics.GetPendingVirtualCores(); this.allocatedVirtualCores = userMetrics.GetAllocatedVirtualCores(); } }
public ClusterMetricsInfo(ResourceManager rm) { // JAXB needs this ResourceScheduler rs = rm.GetResourceScheduler(); QueueMetrics metrics = rs.GetRootQueueMetrics(); ClusterMetrics clusterMetrics = ClusterMetrics.GetMetrics(); this.appsSubmitted = metrics.GetAppsSubmitted(); this.appsCompleted = metrics.GetAppsCompleted(); this.appsPending = metrics.GetAppsPending(); this.appsRunning = metrics.GetAppsRunning(); this.appsFailed = metrics.GetAppsFailed(); this.appsKilled = metrics.GetAppsKilled(); this.reservedMB = metrics.GetReservedMB(); this.availableMB = metrics.GetAvailableMB(); this.allocatedMB = metrics.GetAllocatedMB(); this.reservedVirtualCores = metrics.GetReservedVirtualCores(); this.availableVirtualCores = metrics.GetAvailableVirtualCores(); this.allocatedVirtualCores = metrics.GetAllocatedVirtualCores(); this.containersAllocated = metrics.GetAllocatedContainers(); this.containersPending = metrics.GetPendingContainers(); this.containersReserved = metrics.GetReservedContainers(); this.totalMB = availableMB + allocatedMB; this.totalVirtualCores = availableVirtualCores + allocatedVirtualCores; this.activeNodes = clusterMetrics.GetNumActiveNMs(); this.lostNodes = clusterMetrics.GetNumLostNMs(); this.unhealthyNodes = clusterMetrics.GetUnhealthyNMs(); this.decommissionedNodes = clusterMetrics.GetNumDecommisionedNMs(); this.rebootedNodes = clusterMetrics.GetNumRebootedNMs(); this.totalNodes = activeNodes + lostNodes + decommissionedNodes + rebootedNodes + unhealthyNodes; }
/// <exception cref="Org.Codehaus.Jettison.Json.JSONException"/> /// <exception cref="System.Exception"/> public virtual void VerifyClusterMetrics(int submittedApps, int completedApps, int reservedMB, int availableMB, int allocMB, int reservedVirtualCores, int availableVirtualCores , int allocVirtualCores, int totalVirtualCores, int containersAlloc, int totalMB , int totalNodes, int lostNodes, int unhealthyNodes, int decommissionedNodes, int rebootedNodes, int activeNodes) { ResourceScheduler rs = rm.GetResourceScheduler(); QueueMetrics metrics = rs.GetRootQueueMetrics(); ClusterMetrics clusterMetrics = ClusterMetrics.GetMetrics(); long totalMBExpect = metrics.GetAvailableMB() + metrics.GetAllocatedMB(); long totalVirtualCoresExpect = metrics.GetAvailableVirtualCores() + metrics.GetAllocatedVirtualCores (); NUnit.Framework.Assert.AreEqual("appsSubmitted doesn't match", metrics.GetAppsSubmitted (), submittedApps); NUnit.Framework.Assert.AreEqual("appsCompleted doesn't match", metrics.GetAppsCompleted (), completedApps); NUnit.Framework.Assert.AreEqual("reservedMB doesn't match", metrics.GetReservedMB (), reservedMB); NUnit.Framework.Assert.AreEqual("availableMB doesn't match", metrics.GetAvailableMB (), availableMB); NUnit.Framework.Assert.AreEqual("allocatedMB doesn't match", metrics.GetAllocatedMB (), allocMB); NUnit.Framework.Assert.AreEqual("reservedVirtualCores doesn't match", metrics.GetReservedVirtualCores (), reservedVirtualCores); NUnit.Framework.Assert.AreEqual("availableVirtualCores doesn't match", metrics.GetAvailableVirtualCores (), availableVirtualCores); NUnit.Framework.Assert.AreEqual("allocatedVirtualCores doesn't match", totalVirtualCoresExpect , allocVirtualCores); NUnit.Framework.Assert.AreEqual("containersAllocated doesn't match", 0, containersAlloc ); NUnit.Framework.Assert.AreEqual("totalMB doesn't match", totalMBExpect, totalMB); NUnit.Framework.Assert.AreEqual("totalNodes doesn't match", clusterMetrics.GetNumActiveNMs () + clusterMetrics.GetNumLostNMs() + clusterMetrics.GetNumDecommisionedNMs() + clusterMetrics.GetNumRebootedNMs() + clusterMetrics.GetUnhealthyNMs(), totalNodes ); NUnit.Framework.Assert.AreEqual("lostNodes doesn't match", clusterMetrics.GetNumLostNMs (), lostNodes); NUnit.Framework.Assert.AreEqual("unhealthyNodes doesn't match", clusterMetrics.GetUnhealthyNMs (), unhealthyNodes); NUnit.Framework.Assert.AreEqual("decommissionedNodes doesn't match", clusterMetrics .GetNumDecommisionedNMs(), decommissionedNodes); NUnit.Framework.Assert.AreEqual("rebootedNodes doesn't match", clusterMetrics.GetNumRebootedNMs (), rebootedNodes); NUnit.Framework.Assert.AreEqual("activeNodes doesn't match", clusterMetrics.GetNumActiveNMs (), activeNodes); }