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

@Private @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).
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.hadoop.yarn.api.records.Resource
    Assign a container on this node if possible, and return the amount of resources assigned.
    org.apache.hadoop.yarn.api.records.Resource
    Maximum number of resources required by this Schedulable.
    org.apache.hadoop.yarn.api.records.Resource
    Get the fair share assigned to this Schedulable.
    org.apache.hadoop.yarn.api.records.Resource
    Maximum Resource share assigned to the schedulable.
    org.apache.hadoop.yarn.api.records.Resource
    Minimum Resource share assigned to the schedulable.
    Name of job/queue, used for debugging as well as for breaking ties in scheduling order deterministically.
    org.apache.hadoop.yarn.api.records.Priority
    Job priority for jobs in FIFO queues; meaningless for QueueSchedulables.
    org.apache.hadoop.yarn.api.records.Resource
    Get the aggregate amount of resources consumed by the schedulable.
    long
    Start time for jobs in FIFO queues; meaningless for QueueSchedulables.
    float
    Job/queue weight in fair sharing.
    boolean
    Check whether the schedulable is preemptable.
    void
    setFairShare(org.apache.hadoop.yarn.api.records.Resource fairShare)
    Assign a fair share to this Schedulable.
    void
    Refresh the Schedulable's demand and those of its children if any.
  • Method Details

    • getName

      String getName()
      Name of job/queue, used for debugging as well as for breaking ties in scheduling order deterministically.
      Returns:
      Name of job/queue.
    • 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).
      Returns:
      resources required by this Schedulable.
    • getResourceUsage

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

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

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

      float getWeight()
      Job/queue weight in fair sharing. Weights are only meaningful when compared. A weight of 2.0f has twice the weight of a weight of 1.0f, which has twice the weight of a weight of 0.5f. A weight of 1.0f is considered unweighted or a neutral weight. A weight of 0 is no weight.
      Returns:
      the weight
    • getStartTime

      long getStartTime()
      Start time for jobs in FIFO queues; meaningless for QueueSchedulables.
      Returns:
      Start time for jobs.
    • getPriority

      org.apache.hadoop.yarn.api.records.Priority getPriority()
      Job priority for jobs in FIFO queues; meaningless for QueueSchedulables.
      Returns:
      Job priority.
    • 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.
      Parameters:
      node - FSSchedulerNode.
      Returns:
      the amount of resources assigned.
    • getFairShare

      org.apache.hadoop.yarn.api.records.Resource getFairShare()
      Get the fair share assigned to this Schedulable.
      Returns:
      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.
      Parameters:
      fairShare - a fair share to this Schedulable.
    • isPreemptable

      boolean isPreemptable()
      Check whether the schedulable is preemptable.
      Returns:
      true if the schedulable is preemptable; false otherwise