ClusterMetrics (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.mapreduce, class: ClusterMetrics

Package org.apache.hadoop.mapreduce

# Class ClusterMetrics

java.lang.Object
org.apache.hadoop.mapreduce.ClusterMetrics

All Implemented Interfaces:
  `Writable`

@Public @Evolving public class ClusterMetrics extends Object implements Writable
Status information on the current state of the Map-Reduce cluster.

`ClusterMetrics` provides clients with information such as:

1. Size of the cluster.
2. Number of blacklisted and decommissioned trackers.
3. Slot capacity of the cluster.
4. The number of currently occupied/reserved map and reduce slots.
5. The number of currently running map and reduce tasks.
6. The number of job submissions.

Clients can query for the latest `ClusterMetrics`, via `Cluster.getClusterStatus()`.

See Also:
  - `Cluster`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ClusterMetrics()`
  `ClusterMetrics(int runningMaps, int runningReduces, int occupiedMapSlots, int occupiedReduceSlots, int reservedMapSlots, int reservedReduceSlots, int mapSlots, int reduceSlots, int totalJobSubmissions, int numTrackers, int numBlacklistedTrackers, int numDecommissionedNodes)`
  `ClusterMetrics(int runningMaps, int runningReduces, int occupiedMapSlots, int occupiedReduceSlots, int reservedMapSlots, int reservedReduceSlots, int mapSlots, int reduceSlots, int totalJobSubmissions, int numTrackers, int numBlacklistedTrackers, int numGraylistedTrackers, int numDecommissionedNodes)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getBlackListedTaskTrackerCount()`
  Get the number of blacklisted trackers in the cluster.
  `int`
  `getDecommissionedTaskTrackerCount()`
  Get the number of decommissioned trackers in the cluster.
  `int`
  `getGrayListedTaskTrackerCount()`
  Get the number of graylisted trackers in the cluster.
  `int`
  `getMapSlotCapacity()`
  Get the total number of map slots in the cluster.
  `int`
  `getOccupiedMapSlots()`
  Get number of occupied map slots in the cluster.
  `int`
  `getOccupiedReduceSlots()`
  Get the number of occupied reduce slots in the cluster.
  `int`
  `getReduceSlotCapacity()`
  Get the total number of reduce slots in the cluster.
  `int`
  `getReservedMapSlots()`
  Get number of reserved map slots in the cluster.
  `int`
  `getReservedReduceSlots()`
  Get the number of reserved reduce slots in the cluster.
  `int`
  `getRunningMaps()`
  Get the number of running map tasks in the cluster.
  `int`
  `getRunningReduces()`
  Get the number of running reduce tasks in the cluster.
  `int`
  `getTaskTrackerCount()`
  Get the number of active trackers in the cluster.
  `int`
  `getTotalJobSubmissions()`
  Get the total number of job submissions in the cluster.
  `void`
  `readFields(DataInput in)`
  Deserialize the fields of this object from `in`.
  `void`
  `write(DataOutput out)`
  Serialize the fields of this object to `out`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ClusterMetrics

    public ClusterMetrics()

  - ### ClusterMetrics

    public ClusterMetrics(int runningMaps, int runningReduces, int occupiedMapSlots, int occupiedReduceSlots, int reservedMapSlots, int reservedReduceSlots, int mapSlots, int reduceSlots, int totalJobSubmissions, int numTrackers, int numBlacklistedTrackers, int numDecommissionedNodes)

  - ### ClusterMetrics

    public ClusterMetrics(int runningMaps, int runningReduces, int occupiedMapSlots, int occupiedReduceSlots, int reservedMapSlots, int reservedReduceSlots, int mapSlots, int reduceSlots, int totalJobSubmissions, int numTrackers, int numBlacklistedTrackers, int numGraylistedTrackers, int numDecommissionedNodes)

- ## Method Details

  - ### getRunningMaps

    public int getRunningMaps()
    Get the number of running map tasks in the cluster.
    Returns:
      running maps

  - ### getRunningReduces

    public int getRunningReduces()
    Get the number of running reduce tasks in the cluster.
    Returns:
      running reduces

  - ### getOccupiedMapSlots

    public int getOccupiedMapSlots()
    Get number of occupied map slots in the cluster.
    Returns:
      occupied map slot count

  - ### getOccupiedReduceSlots

    public int getOccupiedReduceSlots()
    Get the number of occupied reduce slots in the cluster.
    Returns:
      occupied reduce slot count

  - ### getReservedMapSlots

    public int getReservedMapSlots()
    Get number of reserved map slots in the cluster.
    Returns:
      reserved map slot count

  - ### getReservedReduceSlots

    public int getReservedReduceSlots()
    Get the number of reserved reduce slots in the cluster.
    Returns:
      reserved reduce slot count

  - ### getMapSlotCapacity

    public int getMapSlotCapacity()
    Get the total number of map slots in the cluster.
    Returns:
      map slot capacity

  - ### getReduceSlotCapacity

    public int getReduceSlotCapacity()
    Get the total number of reduce slots in the cluster.
    Returns:
      reduce slot capacity

  - ### getTotalJobSubmissions

    public int getTotalJobSubmissions()
    Get the total number of job submissions in the cluster.
    Returns:
      total number of job submissions

  - ### getTaskTrackerCount

    public int getTaskTrackerCount()
    Get the number of active trackers in the cluster.
    Returns:
      active tracker count.

  - ### getBlackListedTaskTrackerCount

    public int getBlackListedTaskTrackerCount()
    Get the number of blacklisted trackers in the cluster.
    Returns:
      blacklisted tracker count

  - ### getGrayListedTaskTrackerCount

    public int getGrayListedTaskTrackerCount()
    Get the number of graylisted trackers in the cluster.
    Returns:
      graylisted tracker count

  - ### getDecommissionedTaskTrackerCount

    public int getDecommissionedTaskTrackerCount()
    Get the number of decommissioned trackers in the cluster.
    Returns:
      decommissioned tracker count

  - ### readFields

    public void readFields(DataInput in) throws IOException
    Description copied from interface: `Writable`
    Deserialize the fields of this object from `in`.

    For efficiency, implementations should attempt to re-use storage in the existing object where possible.

    Specified by:
      `readFields` in interface `Writable`
    Parameters:
      `in` - `DataInput` to deseriablize this object from.
    Throws:
      `IOException` - any other problem for readFields.

  - ### write

    public void write(DataOutput out) throws IOException
    Description copied from interface: `Writable`
    Serialize the fields of this object to `out`.
    Specified by:
      `write` in interface `Writable`
    Parameters:
      `out` - `DataOuput` to serialize this object into.
    Throws:
      `IOException` - any other problem for write.