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

java.lang.Object
  extended by org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.Schedulable
Direct Known Subclasses:
AppSchedulable, FSQueue

@InterfaceAudience.Private
@InterfaceStability.Unstable
public abstract class Schedulable
extends Object

A Schedulable represents an entity that can launch tasks, such as a job 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. There are currently two types of Schedulables: JobSchedulables, which represent a single job, and QueueSchedulables, which allocate among jobs in their queue. Separate sets of Schedulables are used for maps and reduces. Each queue has both a mapSchedulable and a reduceSchedulable, and so does each job. A Schedulable is responsible for three roles: 1) It can launch tasks through assignTask(). 2) It provides information about the job/queue to the scheduler, including: - Demand (maximum number of tasks required) - Number of currently running tasks - 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).


Constructor Summary
Schedulable()
           
 
Method Summary
abstract  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.
abstract  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.
abstract  org.apache.hadoop.yarn.api.records.Resource getMaxShare()
          Maximum Resource share assigned to the schedulable.
abstract  org.apache.hadoop.yarn.api.records.Resource getMinShare()
          Minimum Resource share assigned to the schedulable.
abstract  String getName()
          Name of job/queue, used for debugging as well as for breaking ties in scheduling order deterministically.
abstract  org.apache.hadoop.yarn.api.records.Priority getPriority()
          Job priority for jobs in FIFO queues; meaningless for QueueSchedulables.
abstract  org.apache.hadoop.yarn.api.records.Resource getResourceUsage()
          Get the aggregate amount of resources consumed by the schedulable.
abstract  long getStartTime()
          Start time for jobs in FIFO queues; meaningless for QueueSchedulables.
abstract  ResourceWeights getWeights()
          Job/queue weight in fair sharing.
 void setFairShare(org.apache.hadoop.yarn.api.records.Resource fairShare)
          Assign a fair share to this Schedulable.
 String toString()
          Convenient toString implementation for debugging.
abstract  void updateDemand()
          Refresh the Schedulable's demand and those of its children if any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Schedulable

public Schedulable()
Method Detail

getName

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


getDemand

public abstract 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

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


getMinShare

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


getMaxShare

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


getWeights

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


getStartTime

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


getPriority

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


updateDemand

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


assignContainer

public abstract 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.


setFairShare

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


getFairShare

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


toString

public String toString()
Convenient toString implementation for debugging.

Overrides:
toString in class Object


Copyright © 2014 Apache Software Foundation. All Rights Reserved.