Enum Class NodeQueueLoadMonitor.LoadComparator

java.lang.Object
java.lang.Enum<NodeQueueLoadMonitor.LoadComparator>
org.apache.hadoop.yarn.server.resourcemanager.scheduler.distributed.NodeQueueLoadMonitor.LoadComparator
All Implemented Interfaces:
Serializable, Comparable<NodeQueueLoadMonitor.LoadComparator>, Constable, Comparator<ClusterNode>
Enclosing class:
NodeQueueLoadMonitor

public static enum NodeQueueLoadMonitor.LoadComparator extends Enum<NodeQueueLoadMonitor.LoadComparator> implements Comparator<ClusterNode>
The comparator used to specify the metric against which the load of two Nodes are compared.
  • Enum Constant Details

    • QUEUE_LENGTH

      public static final NodeQueueLoadMonitor.LoadComparator QUEUE_LENGTH
      This policy only considers queue length. When allocating, increments queue length without looking at resources available on the node, and when sorting, also only sorts by queue length.
    • QUEUE_WAIT_TIME

      public static final NodeQueueLoadMonitor.LoadComparator QUEUE_WAIT_TIME
      This policy only considers the wait time of containers in the queue. Neither looks at resources nor at queue length.
    • QUEUE_LENGTH_THEN_RESOURCES

      public static final NodeQueueLoadMonitor.LoadComparator QUEUE_LENGTH_THEN_RESOURCES
      This policy considers both queue length and resources. When allocating, first decrements resources available on a node. If resources are available, does not place OContainers on the node queue. When sorting, it first sorts by queue length, then by available resources.
  • Method Details

    • values

      public static NodeQueueLoadMonitor.LoadComparator[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static NodeQueueLoadMonitor.LoadComparator valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • compare

      public int compare(ClusterNode o1, ClusterNode o2)
      Specified by:
      compare in interface Comparator<ClusterNode>
    • getResourceCalculator

      public org.apache.hadoop.yarn.util.resource.ResourceCalculator getResourceCalculator()
    • getMetric

      public int getMetric(ClusterNode c)
    • compareAndIncrement

      public boolean compareAndIncrement(ClusterNode c, int incrementSize, org.apache.hadoop.yarn.api.records.Resource requested)
      Increment the metric by a delta if it is below the threshold.
      Parameters:
      c - ClusterNode
      incrementSize - increment size
      requested - the requested resource
      Returns:
      true if the metric was below threshold and was incremented.
    • isNodeAvailable

      public boolean isNodeAvailable(ClusterNode cn)
      Whether we should be placing OContainers on a node.
      Parameters:
      cn - the clusterNode
      Returns:
      whether we should be placing OContainers on a node.