org.apache.hadoop.yarn.server.scheduler

## 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 Summary

    Constructors
    Constructor and Description
    `OpportunisticContainerContext()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addToOutstandingReqs(List<org.apache.hadoop.yarn.api.records.ResourceRequest> resourceAsks)` Takes a list of ResourceRequests (asks), extracts the key information viz.
    `OpportunisticContainerAllocator.AllocationParams` | `getAppParams()`
    `Set<String>` | `getBlacklist()`
    `OpportunisticContainerAllocator.ContainerIdGenerator` | `getContainerIdGenerator()`
    `Map<String,RemoteNode>` | `getNodeMap()`
    `TreeMap<SchedulerRequestKey,Map<org.apache.hadoop.yarn.api.records.Resource,org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerAllocator.EnrichedResourceRequest>>` | `getOutstandingOpReqs()`
    `void` | `matchAllocationToOutstandingRequest(org.apache.hadoop.yarn.api.records.Resource capability, List<org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerAllocator.Allocation> allocations)` This method matches a returned list of Container Allocations to any outstanding OPPORTUNISTIC ResourceRequest.
    `void` | `setContainerIdGenerator(OpportunisticContainerAllocator.ContainerIdGenerator containerIdGenerator)`
    `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)`
    `void` | `updateNodeList(List<RemoteNode> newNodeList)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OpportunisticContainerContext

          public OpportunisticContainerContext()

  - ### Method Detail

    - #### getAppParams

          public OpportunisticContainerAllocator.AllocationParams 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,org.apache.hadoop.yarn.server.scheduler.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 `ResourceRequest`s

    - #### matchAllocationToOutstandingRequest

          public void matchAllocationToOutstandingRequest(org.apache.hadoop.yarn.api.records.Resource capability,
                                                          List<org.apache.hadoop.yarn.server.scheduler.OpportunisticContainerAllocator.Allocation> allocations)

      This method matches a returned list of Container Allocations to any outstanding OPPORTUNISTIC ResourceRequest.
      Parameters:
        `capability` - Capability
        `allocations` - Allocations.

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.