public abstract class OpportunisticContainerAllocator extends Object
Base abstract class for Opportunistic container allocations, that provides common functions required for Opportunistic container allocation.
| Modifier and Type | Class and Description | 
|---|---|
| static class  | OpportunisticContainerAllocator.AllocationThis class encapsulates container and resourceName for an allocation. | 
| static class  | OpportunisticContainerAllocator.AllocationParamsThis class encapsulates application specific parameters used to build a
 Container. | 
| static class  | OpportunisticContainerAllocator.ContainerIdGeneratorA Container Id Generator. | 
| static class  | OpportunisticContainerAllocator.EnrichedResourceRequestThis class encapsulates Resource Request and provides requests per
 node and rack. | 
| static class  | OpportunisticContainerAllocator.PartitionedResourceRequestsClass that includes two lists of  ResourceRequests: one for
 GUARANTEED and one for OPPORTUNISTICResourceRequests. | 
| Constructor and Description | 
|---|
| OpportunisticContainerAllocator(BaseContainerTokenSecretManager tokenSecretManager)Create a new Opportunistic Container Allocator. | 
| OpportunisticContainerAllocator(BaseContainerTokenSecretManager tokenSecretManager,
                               int maxAllocationsPerAMHeartbeat)Create a new Opportunistic Container Allocator. | 
| Modifier and Type | Method and Description | 
|---|---|
| abstract List<org.apache.hadoop.yarn.api.records.Container> | allocateContainers(org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest blackList,
                  List<org.apache.hadoop.yarn.api.records.ResourceRequest> oppResourceReqs,
                  org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId,
                  OpportunisticContainerContext opportContext,
                  long rmIdentifier,
                  String appSubmitter)Allocate OPPORTUNISTIC containers. | 
| protected org.apache.hadoop.yarn.api.records.Container | createContainer(long rmIdentifier,
               OpportunisticContainerAllocator.AllocationParams appParams,
               OpportunisticContainerAllocator.ContainerIdGenerator idCounter,
               org.apache.hadoop.yarn.api.records.ApplicationAttemptId id,
               String userName,
               Map<org.apache.hadoop.yarn.api.records.Resource,List<OpportunisticContainerAllocator.Allocation>> allocations,
               String location,
               org.apache.hadoop.yarn.api.records.ResourceRequest anyAsk,
               RemoteNode rNode) | 
| int | getMaxAllocationsPerAMHeartbeat()Get the Max Allocations per AM heartbeat. | 
| protected String | getRemoteNodePartition(RemoteNode node) | 
| protected String | getRequestPartition(OpportunisticContainerAllocator.EnrichedResourceRequest enrichedRR) | 
| protected int | getTotalAllocations(List<Map<org.apache.hadoop.yarn.api.records.Resource,List<OpportunisticContainerAllocator.Allocation>>> allocations) | 
| protected void | matchAllocation(List<Map<org.apache.hadoop.yarn.api.records.Resource,List<OpportunisticContainerAllocator.Allocation>>> allocations,
               List<org.apache.hadoop.yarn.api.records.Container> allocatedContainers,
               OpportunisticContainerContext oppContext) | 
| OpportunisticContainerAllocator.PartitionedResourceRequests | partitionAskList(List<org.apache.hadoop.yarn.api.records.ResourceRequest> askList)Partitions a list of ResourceRequest to two separate lists, one for
 GUARANTEED and one for OPPORTUNISTIC ResourceRequests. | 
| void | setMaxAllocationsPerAMHeartbeat(int maxAllocationsPerAMHeartbeat) | 
| protected void | updateBlacklist(org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest blackList,
               OpportunisticContainerContext oppContext) | 
public OpportunisticContainerAllocator(BaseContainerTokenSecretManager tokenSecretManager)
tokenSecretManager - TokenSecretManagerpublic OpportunisticContainerAllocator(BaseContainerTokenSecretManager tokenSecretManager, int maxAllocationsPerAMHeartbeat)
tokenSecretManager - TokenSecretManagermaxAllocationsPerAMHeartbeat - max number of containers to be
                                     allocated in one AM heartbeatpublic void setMaxAllocationsPerAMHeartbeat(int maxAllocationsPerAMHeartbeat)
public int getMaxAllocationsPerAMHeartbeat()
public abstract List<org.apache.hadoop.yarn.api.records.Container> allocateContainers(org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest blackList, List<org.apache.hadoop.yarn.api.records.ResourceRequest> oppResourceReqs, org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId, OpportunisticContainerContext opportContext, long rmIdentifier, String appSubmitter) throws org.apache.hadoop.yarn.exceptions.YarnException
blackList - Resource BlackList RequestoppResourceReqs - Opportunistic Resource RequestsapplicationAttemptId - ApplicationAttemptIdopportContext - App specific OpportunisticContainerContextrmIdentifier - RM IdentifierappSubmitter - App Submitterorg.apache.hadoop.yarn.exceptions.YarnException - YarnExceptionprotected void updateBlacklist(org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest blackList,
                               OpportunisticContainerContext oppContext)
protected void matchAllocation(List<Map<org.apache.hadoop.yarn.api.records.Resource,List<OpportunisticContainerAllocator.Allocation>>> allocations, List<org.apache.hadoop.yarn.api.records.Container> allocatedContainers, OpportunisticContainerContext oppContext)
protected int getTotalAllocations(List<Map<org.apache.hadoop.yarn.api.records.Resource,List<OpportunisticContainerAllocator.Allocation>>> allocations)
protected org.apache.hadoop.yarn.api.records.Container createContainer(long rmIdentifier,
                                                                       OpportunisticContainerAllocator.AllocationParams appParams,
                                                                       OpportunisticContainerAllocator.ContainerIdGenerator idCounter,
                                                                       org.apache.hadoop.yarn.api.records.ApplicationAttemptId id,
                                                                       String userName,
                                                                       Map<org.apache.hadoop.yarn.api.records.Resource,List<OpportunisticContainerAllocator.Allocation>> allocations,
                                                                       String location,
                                                                       org.apache.hadoop.yarn.api.records.ResourceRequest anyAsk,
                                                                       RemoteNode rNode)
                                                                throws org.apache.hadoop.yarn.exceptions.YarnException
org.apache.hadoop.yarn.exceptions.YarnExceptionpublic OpportunisticContainerAllocator.PartitionedResourceRequests partitionAskList(List<org.apache.hadoop.yarn.api.records.ResourceRequest> askList)
askList - the list of ResourceRequests to be partitionedprotected String getRequestPartition(OpportunisticContainerAllocator.EnrichedResourceRequest enrichedRR)
protected String getRemoteNodePartition(RemoteNode node)
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.