java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt
org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSAppAttempt
All Implemented Interfaces:
Schedulable, SchedulableEntity

@Private @Unstable public class FSAppAttempt extends SchedulerApplicationAttempt implements Schedulable
Represents an application attempt from the viewpoint of the Fair Scheduler.
  • Constructor Details

  • Method Details

    • getMetrics

      public QueueMetrics getMetrics()
      Get metrics reference from containing queue.
      Returns:
      metrics reference from containing queue.
    • getHeadroom

      public org.apache.hadoop.yarn.api.records.Resource getHeadroom()
      Headroom depends on resources in the cluster, current usage of the queue, queue's fair-share and queue's max-resources.
      Overrides:
      getHeadroom in class SchedulerApplicationAttempt
      Returns:
      available resource headroom
    • allocate

      public RMContainer allocate(NodeType type, FSSchedulerNode node, org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey, PendingAsk pendingAsk, org.apache.hadoop.yarn.api.records.Container reservedContainer)
    • getQueue

      public FSLeafQueue getQueue()
      Overrides:
      getQueue in class SchedulerApplicationAttempt
    • recoverContainer

      public boolean recoverContainer(SchedulerNode node, RMContainer rmContainer)
      Overrides:
      recoverContainer in class SchedulerApplicationAttempt
    • unreserve

      public void unreserve(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey, FSSchedulerNode node)
      Remove the reservation on node at the given SchedulerRequestKey. This dispatches SchedulerNode handlers as well.
      Parameters:
      schedulerKey - Scheduler Key
      node - Node
    • getName

      public String getName()
      Description copied from interface: Schedulable
      Name of job/queue, used for debugging as well as for breaking ties in scheduling order deterministically.
      Specified by:
      getName in interface Schedulable
      Returns:
      Name of job/queue.
    • getDemand

      public org.apache.hadoop.yarn.api.records.Resource getDemand()
      Description copied from interface: Schedulable
      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).
      Specified by:
      getDemand in interface Schedulable
      Returns:
      resources required by this Schedulable.
    • getStartTime

      public long getStartTime()
      Description copied from interface: SchedulableEntity
      Start time of the job.
      Specified by:
      getStartTime in interface Schedulable
      Specified by:
      getStartTime in interface SchedulableEntity
      Overrides:
      getStartTime in class SchedulerApplicationAttempt
      Returns:
      start time
    • getMinShare

      public org.apache.hadoop.yarn.api.records.Resource getMinShare()
      Description copied from interface: Schedulable
      Minimum Resource share assigned to the schedulable.
      Specified by:
      getMinShare in interface Schedulable
      Returns:
      Minimum Resource share.
    • getMaxShare

      public org.apache.hadoop.yarn.api.records.Resource getMaxShare()
      Description copied from interface: Schedulable
      Maximum Resource share assigned to the schedulable.
      Specified by:
      getMaxShare in interface Schedulable
      Returns:
      Maximum Resource share.
    • getResourceUsage

      public org.apache.hadoop.yarn.api.records.Resource getResourceUsage()
      Description copied from interface: Schedulable
      Get the aggregate amount of resources consumed by the schedulable.
      Specified by:
      getResourceUsage in interface Schedulable
      Returns:
      aggregate amount of resources.
    • getWeight

      public float getWeight()
      Description copied from interface: Schedulable
      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.
      Specified by:
      getWeight in interface Schedulable
      Returns:
      the weight
    • getPriority

      public org.apache.hadoop.yarn.api.records.Priority getPriority()
      Description copied from interface: SchedulableEntity
      Get the priority of the application.
      Specified by:
      getPriority in interface Schedulable
      Specified by:
      getPriority in interface SchedulableEntity
      Overrides:
      getPriority in class SchedulerApplicationAttempt
      Returns:
      priority of the application.
    • getFairShare

      public org.apache.hadoop.yarn.api.records.Resource getFairShare()
      Description copied from interface: Schedulable
      Get the fair share assigned to this Schedulable.
      Specified by:
      getFairShare in interface Schedulable
      Returns:
      the fair share assigned to this Schedulable.
    • setFairShare

      public void setFairShare(org.apache.hadoop.yarn.api.records.Resource fairShare)
      Description copied from interface: Schedulable
      Assign a fair share to this Schedulable.
      Specified by:
      setFairShare in interface Schedulable
      Parameters:
      fairShare - a fair share to this Schedulable.
    • updateDemand

      public void updateDemand()
      Description copied from interface: Schedulable
      Refresh the Schedulable's demand and those of its children if any.
      Specified by:
      updateDemand in interface Schedulable
    • assignContainer

      public org.apache.hadoop.yarn.api.records.Resource assignContainer(FSSchedulerNode node)
      Description copied from interface: Schedulable
      Assign a container on this node if possible, and return the amount of resources assigned.
      Specified by:
      assignContainer in interface Schedulable
      Parameters:
      node - FSSchedulerNode.
      Returns:
      the amount of resources assigned.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class SchedulerApplicationAttempt
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class SchedulerApplicationAttempt
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isPreemptable

      public boolean isPreemptable()
      Description copied from interface: Schedulable
      Check whether the schedulable is preemptable.
      Specified by:
      isPreemptable in interface Schedulable
      Returns:
      true if the schedulable is preemptable; false otherwise
    • setEnableAMPreemption

      @VisibleForTesting public void setEnableAMPreemption(boolean enableAMPreemption)