/// <exception cref="System.Exception"/> private void VerifyClusterMetrics(int activeNodes, int appsSubmitted, int appsPending , int containersPending, int availableMB, int activeApplications) { int timeoutSecs = 0; QueueMetrics metrics = rm.GetResourceScheduler().GetRootQueueMetrics(); ClusterMetrics clusterMetrics = ClusterMetrics.GetMetrics(); bool isAllMetricAssertionDone = false; string message = null; while (timeoutSecs++ < 5) { try { // verify queue metrics AssertMetric("appsSubmitted", appsSubmitted, metrics.GetAppsSubmitted()); AssertMetric("appsPending", appsPending, metrics.GetAppsPending()); AssertMetric("containersPending", containersPending, metrics.GetPendingContainers ()); AssertMetric("availableMB", availableMB, metrics.GetAvailableMB()); AssertMetric("activeApplications", activeApplications, metrics.GetActiveApps()); // verify node metric AssertMetric("activeNodes", activeNodes, clusterMetrics.GetNumActiveNMs()); isAllMetricAssertionDone = true; break; } catch (Exception e) { message = e.Message; System.Console.Out.WriteLine("Waiting for metrics assertion to complete"); Sharpen.Thread.Sleep(1000); } } NUnit.Framework.Assert.IsTrue(message, isAllMetricAssertionDone); }
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; }
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(); } }