Class DominantResourceFairnessPolicy.DominantResourceFairnessComparator

java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies.DominantResourceFairnessPolicy.DominantResourceFairnessComparator
All Implemented Interfaces:
Comparator<Schedulable>
Enclosing class:
DominantResourceFairnessPolicy

public abstract static class DominantResourceFairnessPolicy.DominantResourceFairnessComparator extends Object implements Comparator<Schedulable>
This class compares two Schedulable instances according to the DRF policy. If neither instance is below min share, approximate fair share ratios are compared. Subclasses of this class will do the actual work of the comparison, specialized for the number of configured resource types.
  • Field Details

  • Constructor Details

    • DominantResourceFairnessComparator

      public DominantResourceFairnessComparator()
  • Method Details

    • setFSContext

      public void setFSContext(FSContext fsContext)
    • compareAttributes

      protected int compareAttributes(Schedulable s1, Schedulable s2)
      This method is used when apps are tied in fairness ratio. It breaks the tie by submit time and job name to get a deterministic ordering, which is useful for unit tests.
      Parameters:
      s1 - the first item to compare
      s2 - the second item to compare
      Returns:
      < 0, 0, or > 0 if the first item is less than, equal to, or greater than the second item, respectively