org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair
Interface Schedulable

All Known Implementing Classes:
FSAppAttempt, FSLeafQueue, FSParentQueue, FSQueue

@InterfaceAudience.Private
@InterfaceStability.Unstable
public interface Schedulable

A Schedulable represents an entity that can be scheduled such as an application or a queue. It provides a common interface so that algorithms such as fair sharing can be applied both within a queue and across queues. A Schedulable is responsible for three roles: 1) Assign resources through assignContainer(org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSSchedulerNode). 2) It provides information about the app/queue to the scheduler, including: - Demand (maximum number of tasks required) - Minimum share (for queues) - Job/queue weight (for fair sharing) - Start time and priority (for FIFO) 3) It can be assigned a fair share, for use with fair scheduling. Schedulable also contains two methods for performing scheduling computations: - updateDemand() is called periodically to compute the demand of the various jobs and queues, which may be expensive (e.g. jobs must iterate through all their tasks to count failed tasks, tasks that can be speculated, etc). - redistributeShare() is called after demands are updated and a Schedulable's fair share has been set by its parent to let it distribute its share among the other Schedulables within it (e.g. for queues that want to perform fair sharing among their jobs).


Method Summary
 org.apache.hadoop.yarn.api.records.Resource assignContainer(FSSchedulerNode node)
          Assign a container on this node if possible, and return the amount of resources assigned.
 org.apache.hadoop.yarn.api.records.Resource getDemand()
          Maximum number of resources required by this Schedulable.
 org.apache.hadoop.yarn.api.records.Resource getFairShare()
          Get the fair share assigned to this Schedulable.
 org.apache.hadoop.yarn.api.records.Resource getMaxShare()
          Maximum Resource share assigned to the schedulable.
 org.apache.hadoop.yarn.api.records.Resource getMinShare()
          Minimum Resource share assigned to the schedulable.
 String getName()
          Name of job/queue, used for debugging as well as for breaking ties in scheduling order deterministically.
 org.apache.hadoop.yarn.api.records.Priority getPriority()
          Job priority for jobs in FIFO queues; meaningless for QueueSchedulables.
 org.apache.hadoop.yarn.api.records.Resource getResourceUsage()
          Get the aggregate amount of resources consumed by the schedulable.
 long getStartTime()
          Start time for jobs in FIFO queues; meaningless for QueueSchedulables.
 ResourceWeights getWeights()
          Job/queue weight in fair sharing.
 RMContainer preemptContainer()
          Preempt a container from this Schedulable if possible.
 void setFairShare(org.apache.hadoop.yarn.api.records.Resource fairShare)
          Assign a fair share to this Schedulable.
 void updateDemand()
          Refresh the Schedulable's demand and those of its children if any.
 

Method Detail

getName

String getName()
Name of job/queue, used for debugging as well as for breaking ties in scheduling order deterministically.


getDemand

org.apache.hadoop.yarn.api.records.Resource getDemand()
Maximum number of resources required by this Schedulable. This is defined as number of currently utilized resources + number of unlaunched resources (that are either not yet launched or need to be speculated).


getResourceUsage

org.apache.hadoop.yarn.api.records.Resource getResourceUsage()
Get the aggregate amount of resources consumed by the schedulable.


getMinShare

org.apache.hadoop.yarn.api.records.Resource getMinShare()
Minimum Resource share assigned to the schedulable.


getMaxShare

org.apache.hadoop.yarn.api.records.Resource getMaxShare()
Maximum Resource share assigned to the schedulable.


getWeights

ResourceWeights getWeights()
Job/queue weight in fair sharing.


getStartTime

long getStartTime()
Start time for jobs in FIFO queues; meaningless for QueueSchedulables.


getPriority

org.apache.hadoop.yarn.api.records.Priority getPriority()
Job priority for jobs in FIFO queues; meaningless for QueueSchedulables.


updateDemand

void updateDemand()
Refresh the Schedulable's demand and those of its children if any.


assignContainer

org.apache.hadoop.yarn.api.records.Resource assignContainer(FSSchedulerNode node)
Assign a container on this node if possible, and return the amount of resources assigned.


preemptContainer

RMContainer preemptContainer()
Preempt a container from this Schedulable if possible.


getFairShare

org.apache.hadoop.yarn.api.records.Resource getFairShare()
Get the fair share assigned to this Schedulable.


setFairShare

void setFairShare(org.apache.hadoop.yarn.api.records.Resource fairShare)
Assign a fair share to this Schedulable.



Copyright © 2014 Apache Software Foundation. All Rights Reserved.