org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair
Class SchedulingPolicy

java.lang.Object
  extended by org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.SchedulingPolicy
Direct Known Subclasses:
DominantResourceFairnessPolicy, FairSharePolicy, FifoPolicy

@InterfaceAudience.Public
@InterfaceStability.Evolving
public abstract class SchedulingPolicy
extends Object


Field Summary
static byte DEPTH_ANY
           
static byte DEPTH_INTERMEDIATE
           
static byte DEPTH_LEAF
           
static byte DEPTH_PARENT
           
static byte DEPTH_ROOT
           
 
Constructor Summary
SchedulingPolicy()
           
 
Method Summary
abstract  void computeShares(Collection<? extends Schedulable> schedulables, org.apache.hadoop.yarn.api.records.Resource totalResources)
          Computes and updates the shares of Schedulables as per the SchedulingPolicy, to be used later at schedule time.
abstract  byte getApplicableDepth()
          Specifies the depths in the hierarchy, this SchedulingPolicy applies to
abstract  Comparator<Schedulable> getComparator()
          The comparator returned by this method is to be used for sorting the Schedulables in that queue.
static SchedulingPolicy getDefault()
           
static SchedulingPolicy getInstance(Class<? extends SchedulingPolicy> clazz)
          Returns a SchedulingPolicy instance corresponding to the passed clazz
abstract  String getName()
           
 void initialize(org.apache.hadoop.yarn.api.records.Resource clusterCapacity)
           
static boolean isApplicableTo(SchedulingPolicy policy, byte depth)
          Checks if the specified SchedulingPolicy can be used for a queue at the specified depth in the hierarchy
static SchedulingPolicy parse(String policy)
          Returns SchedulingPolicy instance corresponding to the SchedulingPolicy passed as a string.
static void setDefault(String className)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEPTH_LEAF

public static final byte DEPTH_LEAF
See Also:
Constant Field Values

DEPTH_INTERMEDIATE

public static final byte DEPTH_INTERMEDIATE
See Also:
Constant Field Values

DEPTH_ROOT

public static final byte DEPTH_ROOT
See Also:
Constant Field Values

DEPTH_PARENT

public static final byte DEPTH_PARENT
See Also:
Constant Field Values

DEPTH_ANY

public static final byte DEPTH_ANY
See Also:
Constant Field Values
Constructor Detail

SchedulingPolicy

public SchedulingPolicy()
Method Detail

getDefault

public static SchedulingPolicy getDefault()

setDefault

public static void setDefault(String className)
                       throws AllocationConfigurationException
Throws:
AllocationConfigurationException

getInstance

public static SchedulingPolicy getInstance(Class<? extends SchedulingPolicy> clazz)
Returns a SchedulingPolicy instance corresponding to the passed clazz


parse

public static SchedulingPolicy parse(String policy)
                              throws AllocationConfigurationException
Returns SchedulingPolicy instance corresponding to the SchedulingPolicy passed as a string. The policy can be "fair" for FairSharePolicy, "fifo" for FifoPolicy, or "drf" for DominantResourceFairnessPolicy. For a custom SchedulingPolicys in the RM classpath, the policy should be canonical class name of the SchedulingPolicy.

Parameters:
policy - canonical class name or "drf" or "fair" or "fifo"
Throws:
AllocationConfigurationException

initialize

public void initialize(org.apache.hadoop.yarn.api.records.Resource clusterCapacity)

getName

public abstract String getName()
Returns:
returns the name of SchedulingPolicy

getApplicableDepth

public abstract byte getApplicableDepth()
Specifies the depths in the hierarchy, this SchedulingPolicy applies to

Returns:
depth equal to one of fields SchedulingPolicy#DEPTH_*

isApplicableTo

public static boolean isApplicableTo(SchedulingPolicy policy,
                                     byte depth)
Checks if the specified SchedulingPolicy can be used for a queue at the specified depth in the hierarchy

Parameters:
policy - SchedulingPolicy we are checking the depth-applicability for
depth - queue's depth in the hierarchy
Returns:
true if policy is applicable to passed depth, false otherwise

getComparator

public abstract Comparator<Schedulable> getComparator()
The comparator returned by this method is to be used for sorting the Schedulables in that queue.

Returns:
the comparator to sort by

computeShares

public abstract void computeShares(Collection<? extends Schedulable> schedulables,
                                   org.apache.hadoop.yarn.api.records.Resource totalResources)
Computes and updates the shares of Schedulables as per the SchedulingPolicy, to be used later at schedule time.

Parameters:
schedulables - Schedulables whose shares are to be updated
totalResources - Total Resources in the cluster


Copyright © 2014 Apache Software Foundation. All Rights Reserved.