Java Code Examples for org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler#getRootQueueMetrics()

The following examples show how to use org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler#getRootQueueMetrics() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserMetricsInfo.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public UserMetricsInfo(final ResourceManager rm, final String user) {
  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();

    this.reservedGpuCores = userMetrics.getReservedGpuCores();
    this.pendingGpuCores = userMetrics.getPendingGpuCores();
    this.allocatedGpuCores = userMetrics.getAllocatedGpuCores();
  }
}
 
Example 2
Source File: ClusterMetricsInfo.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public ClusterMetricsInfo(final ResourceManager rm) {
  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.reservedGpuCores = metrics.getReservedGpuCores();
  this.availableGpuCores = metrics.getAvailableGpuCores();
  this.allocatedGpuCores = metrics.getAllocatedGpuCores();

  this.containersAllocated = metrics.getAllocatedContainers();
  this.containersPending = metrics.getPendingContainers();
  this.containersReserved = metrics.getReservedContainers();

  this.totalMB = availableMB + allocatedMB;
  this.totalVirtualCores = availableVirtualCores + allocatedVirtualCores;
  this.totalGpuCores = availableGpuCores + allocatedGpuCores;
  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;
}
 
Example 3
Source File: UserMetricsInfo.java    From big-c with Apache License 2.0 5 votes vote down vote up
public UserMetricsInfo(final ResourceManager rm, final String user) {
  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();
  }
}
 
Example 4
Source File: ClusterMetricsInfo.java    From big-c with Apache License 2.0 5 votes vote down vote up
public ClusterMetricsInfo(final ResourceManager rm) {
  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;
}
 
Example 5
Source File: TestRMWebServices.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public void verifyClusterMetrics(int submittedApps, int completedApps,
    int reservedMB, int availableMB,
    int allocMB, int reservedVirtualCores, int availableVirtualCores, 
    int allocVirtualCores, int totalVirtualCores,
    int reservedGpuCores, int availableGpuCores,
    int allocGpuCores, int totalGpuCores,
    int containersAlloc, int totalMB, int totalNodes,
    int lostNodes, int unhealthyNodes, int decommissionedNodes,
    int rebootedNodes, int activeNodes) throws JSONException, Exception {

  ResourceScheduler rs = rm.getResourceScheduler();
  QueueMetrics metrics = rs.getRootQueueMetrics();
  ClusterMetrics clusterMetrics = ClusterMetrics.getMetrics();

  long totalMBExpect = 
      metrics.getAvailableMB() + metrics.getAllocatedMB();
  long totalVirtualCoresExpect = 
      metrics.getAvailableVirtualCores() + metrics.getAllocatedVirtualCores();
  long totalGpuCoresExpect =
      metrics.getAvailableGpuCores() + metrics.getAllocatedGpuCores();
  assertEquals("appsSubmitted doesn't match", 
      metrics.getAppsSubmitted(), submittedApps);
  assertEquals("appsCompleted doesn't match", 
      metrics.getAppsCompleted(), completedApps);
  assertEquals("reservedMB doesn't match",
      metrics.getReservedMB(), reservedMB);
  assertEquals("availableMB doesn't match", 
      metrics.getAvailableMB(), availableMB);
  assertEquals("allocatedMB doesn't match", 
      metrics.getAllocatedMB(), allocMB);
  assertEquals("reservedVirtualCores doesn't match",
      metrics.getReservedVirtualCores(), reservedVirtualCores);
  assertEquals("availableVirtualCores doesn't match",
      metrics.getAvailableVirtualCores(), availableVirtualCores);
  assertEquals("allocatedVirtualCores doesn't match",
      totalVirtualCoresExpect, allocVirtualCores);
  assertEquals("reservedGpuCores doesn't match",
      metrics.getReservedGpuCores(), reservedGpuCores);
  assertEquals("availableGpuCores doesn't match",
      metrics.getAvailableGpuCores(), availableGpuCores);
  assertEquals("allocatedGpuCores doesn't match",
      totalGpuCoresExpect, allocGpuCores);
  assertEquals("containersAllocated doesn't match", 0, containersAlloc);
  assertEquals("totalMB doesn't match", totalMBExpect, totalMB);
  assertEquals(
      "totalNodes doesn't match",
      clusterMetrics.getNumActiveNMs() + clusterMetrics.getNumLostNMs()
          + clusterMetrics.getNumDecommisionedNMs()
          + clusterMetrics.getNumRebootedNMs()
          + clusterMetrics.getUnhealthyNMs(), totalNodes);
  assertEquals("lostNodes doesn't match", clusterMetrics.getNumLostNMs(),
      lostNodes);
  assertEquals("unhealthyNodes doesn't match",
      clusterMetrics.getUnhealthyNMs(), unhealthyNodes);
  assertEquals("decommissionedNodes doesn't match",
      clusterMetrics.getNumDecommisionedNMs(), decommissionedNodes);
  assertEquals("rebootedNodes doesn't match",
      clusterMetrics.getNumRebootedNMs(), rebootedNodes);
  assertEquals("activeNodes doesn't match", clusterMetrics.getNumActiveNMs(),
      activeNodes);
}
 
Example 6
Source File: TestRMWebServices.java    From big-c with Apache License 2.0 4 votes vote down vote up
public 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) throws JSONException, Exception {

  ResourceScheduler rs = rm.getResourceScheduler();
  QueueMetrics metrics = rs.getRootQueueMetrics();
  ClusterMetrics clusterMetrics = ClusterMetrics.getMetrics();

  long totalMBExpect = 
      metrics.getAvailableMB() + metrics.getAllocatedMB();
  long totalVirtualCoresExpect = 
      metrics.getAvailableVirtualCores() + metrics.getAllocatedVirtualCores();
  assertEquals("appsSubmitted doesn't match", 
      metrics.getAppsSubmitted(), submittedApps);
  assertEquals("appsCompleted doesn't match", 
      metrics.getAppsCompleted(), completedApps);
  assertEquals("reservedMB doesn't match",
      metrics.getReservedMB(), reservedMB);
  assertEquals("availableMB doesn't match", 
      metrics.getAvailableMB(), availableMB);
  assertEquals("allocatedMB doesn't match", 
      metrics.getAllocatedMB(), allocMB);
  assertEquals("reservedVirtualCores doesn't match",
      metrics.getReservedVirtualCores(), reservedVirtualCores);
  assertEquals("availableVirtualCores doesn't match",
      metrics.getAvailableVirtualCores(), availableVirtualCores);
  assertEquals("allocatedVirtualCores doesn't match",
      totalVirtualCoresExpect, allocVirtualCores);
  assertEquals("containersAllocated doesn't match", 0, containersAlloc);
  assertEquals("totalMB doesn't match", totalMBExpect, totalMB);
  assertEquals(
      "totalNodes doesn't match",
      clusterMetrics.getNumActiveNMs() + clusterMetrics.getNumLostNMs()
          + clusterMetrics.getNumDecommisionedNMs()
          + clusterMetrics.getNumRebootedNMs()
          + clusterMetrics.getUnhealthyNMs(), totalNodes);
  assertEquals("lostNodes doesn't match", clusterMetrics.getNumLostNMs(),
      lostNodes);
  assertEquals("unhealthyNodes doesn't match",
      clusterMetrics.getUnhealthyNMs(), unhealthyNodes);
  assertEquals("decommissionedNodes doesn't match",
      clusterMetrics.getNumDecommisionedNMs(), decommissionedNodes);
  assertEquals("rebootedNodes doesn't match",
      clusterMetrics.getNumRebootedNMs(), rebootedNodes);
  assertEquals("activeNodes doesn't match", clusterMetrics.getNumActiveNMs(),
      activeNodes);
}