Class OpportunisticContainerContext

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

public class OpportunisticContainerContext extends Object
This encapsulates application specific information used by the Opportunistic Container Allocator to allocate containers.
  • Constructor Details

    • OpportunisticContainerContext

      public OpportunisticContainerContext()
  • Method Details

    • getAppParams

    • getContainerIdGenerator

      public OpportunisticContainerAllocator.ContainerIdGenerator getContainerIdGenerator()
    • setContainerIdGenerator

      public void setContainerIdGenerator(OpportunisticContainerAllocator.ContainerIdGenerator containerIdGenerator)
    • getNodeMap

      public Map<String,RemoteNode> getNodeMap()
    • updateNodeList

      public void updateNodeList(List<RemoteNode> newNodeList)
    • updateAllocationParams

      public void updateAllocationParams(org.apache.hadoop.yarn.api.records.Resource minResource, org.apache.hadoop.yarn.api.records.Resource maxResource, org.apache.hadoop.yarn.api.records.Resource incrResource, int containerTokenExpiryInterval)
    • getBlacklist

      public Set<String> getBlacklist()
    • getOutstandingOpReqs

      public TreeMap<SchedulerRequestKey,Map<org.apache.hadoop.yarn.api.records.Resource,OpportunisticContainerAllocator.EnrichedResourceRequest>> getOutstandingOpReqs()
    • addToOutstandingReqs

      public void addToOutstandingReqs(List<org.apache.hadoop.yarn.api.records.ResourceRequest> resourceAsks)
      Takes a list of ResourceRequests (asks), extracts the key information viz. (Priority, ResourceName, Capability) and adds to the outstanding OPPORTUNISTIC outstandingOpReqs map. The nested map is required to enforce the current YARN constraint that only a single ResourceRequest can exist at a give Priority and Capability.
      Parameters:
      resourceAsks - the list with the ResourceRequests
    • matchAllocationToOutstandingRequest

      public void matchAllocationToOutstandingRequest(org.apache.hadoop.yarn.api.records.Resource capability, List<OpportunisticContainerAllocator.Allocation> allocations)
      This method matches a returned list of Container Allocations to any outstanding OPPORTUNISTIC ResourceRequest.
      Parameters:
      capability - Capability
      allocations - Allocations.
    • getOppSchedulerMetrics

      @VisibleForTesting public OpportunisticSchedulerMetrics getOppSchedulerMetrics()