java.lang.Object
org.apache.hadoop.yarn.server.resourcemanager.scheduler.constraint.processor.BatchedRequests
All Implemented Interfaces:
Iterable<org.apache.hadoop.yarn.api.records.SchedulingRequest>, ConstraintPlacementAlgorithmInput

public class BatchedRequests extends Object implements ConstraintPlacementAlgorithmInput, Iterable<org.apache.hadoop.yarn.api.records.SchedulingRequest>
A grouping of Scheduling Requests which are sent to the PlacementAlgorithm to place as a batch. The placement algorithm tends to give more optimal placements if more requests are batched together.
  • Constructor Details

    • BatchedRequests

      public BatchedRequests(BatchedRequests.IteratorType type, org.apache.hadoop.yarn.api.records.ApplicationId applicationId, Collection<org.apache.hadoop.yarn.api.records.SchedulingRequest> requests, int attempt)
  • Method Details

    • iterator

      public Iterator<org.apache.hadoop.yarn.api.records.SchedulingRequest> iterator()
      Exposes SchedulingRequest Iterator interface which can be used to traverse requests using different heuristics i.e. Tag Popularity
      Specified by:
      iterator in interface Iterable<org.apache.hadoop.yarn.api.records.SchedulingRequest>
      Returns:
      SchedulingRequest Iterator.
    • getApplicationId

      public org.apache.hadoop.yarn.api.records.ApplicationId getApplicationId()
      Get Application Id.
      Returns:
      Application Id.
    • getSchedulingRequests

      public Collection<org.apache.hadoop.yarn.api.records.SchedulingRequest> getSchedulingRequests()
      Get Collection of SchedulingRequests in this batch.
      Specified by:
      getSchedulingRequests in interface ConstraintPlacementAlgorithmInput
      Returns:
      Collection of Scheduling Requests.
    • addToBatch

      public void addToBatch(org.apache.hadoop.yarn.api.records.SchedulingRequest req)
      Add a Scheduling request to the batch.
      Parameters:
      req - Scheduling Request.
    • addToBlacklist

      public void addToBlacklist(Set<String> tags, SchedulerNode node)
    • getPlacementAttempt

      public int getPlacementAttempt()
      Get placement attempt.
      Returns:
      PlacementAlgorithmOutput placement Attempt.
    • getBlacklist

      public Set<org.apache.hadoop.yarn.api.records.NodeId> getBlacklist(String tag)
      Get any blacklisted nodes associated with tag.
      Parameters:
      tag - Tag.
      Returns:
      Set of blacklisted Nodes.
    • getIteratorType

      public BatchedRequests.IteratorType getIteratorType()
      Get Iterator type.
      Returns:
      Iterator type.