org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies
Class FifoPolicy

java.lang.Object
  extended by org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.SchedulingPolicy
      extended by org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.policies.FifoPolicy

@InterfaceAudience.Private
@InterfaceStability.Unstable
public class FifoPolicy
extends SchedulingPolicy


Field Summary
static String NAME
           
 
Fields inherited from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.SchedulingPolicy
DEFAULT_POLICY, DEPTH_ANY, DEPTH_INTERMEDIATE, DEPTH_LEAF, DEPTH_PARENT, DEPTH_ROOT
 
Constructor Summary
FifoPolicy()
           
 
Method Summary
 boolean checkIfAMResourceUsageOverLimit(org.apache.hadoop.yarn.api.records.Resource usage, org.apache.hadoop.yarn.api.records.Resource maxAMResource)
          Check if a leaf queue's AM resource usage over its limit under this policy
 boolean checkIfUsageOverFairShare(org.apache.hadoop.yarn.api.records.Resource usage, org.apache.hadoop.yarn.api.records.Resource fairShare)
          Check if the resource usage is over the fair share under this policy
 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 for scheduling decisions.
 void computeSteadyShares(Collection<? extends FSQueue> queues, org.apache.hadoop.yarn.api.records.Resource totalResources)
          Computes and updates the steady shares of FSQueues as per the SchedulingPolicy.
 byte getApplicableDepth()
          Specifies the depths in the hierarchy, this SchedulingPolicy applies to
 Comparator<Schedulable> getComparator()
          The comparator returned by this method is to be used for sorting the Schedulables in that queue.
 org.apache.hadoop.yarn.api.records.Resource getHeadroom(org.apache.hadoop.yarn.api.records.Resource queueFairShare, org.apache.hadoop.yarn.api.records.Resource queueUsage, org.apache.hadoop.yarn.api.records.Resource clusterAvailable)
          Get headroom by calculating the min of clusterAvailable and (queueFairShare - queueUsage) resources that are applicable to this policy.
 String getName()
           
 
Methods inherited from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.SchedulingPolicy
getInstance, initialize, isApplicableTo, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
See Also:
Constant Field Values
Constructor Detail

FifoPolicy

public FifoPolicy()
Method Detail

getName

public String getName()
Specified by:
getName in class SchedulingPolicy
Returns:
returns the name of SchedulingPolicy

getComparator

public Comparator<Schedulable> getComparator()
Description copied from class: SchedulingPolicy
The comparator returned by this method is to be used for sorting the Schedulables in that queue.

Specified by:
getComparator in class SchedulingPolicy
Returns:
the comparator to sort by

computeShares

public void computeShares(Collection<? extends Schedulable> schedulables,
                          org.apache.hadoop.yarn.api.records.Resource totalResources)
Description copied from class: SchedulingPolicy
Computes and updates the shares of Schedulables as per the SchedulingPolicy, to be used later for scheduling decisions. The shares computed are instantaneous and only consider queues with running applications.

Specified by:
computeShares in class SchedulingPolicy
Parameters:
schedulables - Schedulables whose shares are to be updated
totalResources - Total Resources in the cluster

computeSteadyShares

public void computeSteadyShares(Collection<? extends FSQueue> queues,
                                org.apache.hadoop.yarn.api.records.Resource totalResources)
Description copied from class: SchedulingPolicy
Computes and updates the steady shares of FSQueues as per the SchedulingPolicy. The steady share does not differentiate between queues with and without running applications under them. The steady share is not used for scheduling, it is displayed on the Web UI for better visibility.

Specified by:
computeSteadyShares in class SchedulingPolicy
Parameters:
queues - FSQueues whose shares are to be updated
totalResources - Total Resources in the cluster

checkIfUsageOverFairShare

public boolean checkIfUsageOverFairShare(org.apache.hadoop.yarn.api.records.Resource usage,
                                         org.apache.hadoop.yarn.api.records.Resource fairShare)
Description copied from class: SchedulingPolicy
Check if the resource usage is over the fair share under this policy

Specified by:
checkIfUsageOverFairShare in class SchedulingPolicy
Parameters:
usage - Resource the resource usage
fairShare - Resource the fair share
Returns:
true if check passes (is over) or false otherwise

checkIfAMResourceUsageOverLimit

public boolean checkIfAMResourceUsageOverLimit(org.apache.hadoop.yarn.api.records.Resource usage,
                                               org.apache.hadoop.yarn.api.records.Resource maxAMResource)
Description copied from class: SchedulingPolicy
Check if a leaf queue's AM resource usage over its limit under this policy

Specified by:
checkIfAMResourceUsageOverLimit in class SchedulingPolicy
Parameters:
usage - Resource the resource used by application masters
maxAMResource - Resource the maximum allowed resource for application masters
Returns:
true if AM resource usage is over the limit

getHeadroom

public org.apache.hadoop.yarn.api.records.Resource getHeadroom(org.apache.hadoop.yarn.api.records.Resource queueFairShare,
                                                               org.apache.hadoop.yarn.api.records.Resource queueUsage,
                                                               org.apache.hadoop.yarn.api.records.Resource clusterAvailable)
Description copied from class: SchedulingPolicy
Get headroom by calculating the min of clusterAvailable and (queueFairShare - queueUsage) resources that are applicable to this policy. For eg if only memory then leave other resources such as CPU to same as clusterAvailable.

Specified by:
getHeadroom in class SchedulingPolicy
Parameters:
queueFairShare - fairshare in the queue
queueUsage - resources used in the queue
clusterAvailable - available resource in cluster
Returns:
calculated headroom

getApplicableDepth

public byte getApplicableDepth()
Description copied from class: SchedulingPolicy
Specifies the depths in the hierarchy, this SchedulingPolicy applies to

Specified by:
getApplicableDepth in class SchedulingPolicy
Returns:
depth equal to one of fields SchedulingPolicy#DEPTH_*


Copyright © 2014 Apache Software Foundation. All Rights Reserved.