Class ResourceRequestSet

java.lang.Object
org.apache.hadoop.yarn.server.scheduler.ResourceRequestSet

public class ResourceRequestSet extends Object
A set of resource requests of the same scheduler key ResourceRequestSetKey.
  • Constructor Details

    • ResourceRequestSet

      public ResourceRequestSet(ResourceRequestSetKey key) throws org.apache.hadoop.yarn.exceptions.YarnException
      Create a empty set with given key.
      Parameters:
      key - the key of the request set
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException - if fails
    • ResourceRequestSet

      public ResourceRequestSet(ResourceRequestSet other)
      Create a shallow copy of the request set.
      Parameters:
      other - the set of copy from
  • Method Details

    • addAndOverrideRR

      public void addAndOverrideRR(org.apache.hadoop.yarn.api.records.ResourceRequest ask) throws org.apache.hadoop.yarn.exceptions.YarnException
      Add a ResourceRequest into the requestSet. If there's already an RR with the same resource name, override it and update accordingly.
      Parameters:
      ask - the new ResourceRequest
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException - indicates exceptions from yarn servers.
    • addAndOverrideRRSet

      public void addAndOverrideRRSet(ResourceRequestSet requestSet) throws org.apache.hadoop.yarn.exceptions.YarnException
      Merge a requestSet into this one.
      Parameters:
      requestSet - the requestSet to merge
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException - indicates exceptions from yarn servers.
    • cleanupZeroNonAnyRR

      public void cleanupZeroNonAnyRR()
      Remove all non-Any ResourceRequests from the set. This is necessary cleanup to avoid requestSet getting too big.
    • getAsks

      public Map<String,org.apache.hadoop.yarn.api.records.ResourceRequest> getAsks()
    • getRRs

      public Collection<org.apache.hadoop.yarn.api.records.ResourceRequest> getRRs()
    • getNumContainers

      public int getNumContainers()
    • setNumContainers

      public void setNumContainers(int newValue) throws org.apache.hadoop.yarn.exceptions.YarnException
      Force set the # of containers to ask for this requestSet to a given value.
      Parameters:
      newValue - the new # of containers value
      Throws:
      org.apache.hadoop.yarn.exceptions.YarnException - indicates exceptions from yarn servers.
    • isANYRelaxable

      public boolean isANYRelaxable()
      Whether the request set is relaxable at ANY level.
      Returns:
      whether the request set is relaxable at ANY level
    • toString

      public String toString()
      Overrides:
      toString in class Object