public class LocalityAppPlacementAllocator<N extends SchedulerNode> extends AppPlacementAllocator<N>
AppPlacementAllocator that takes
into account locality preferences (node, rack, any) when allocating
containers.appSchedulingInfo, rmContext, schedulerRequestKey| Constructor | Description |
|---|---|
LocalityAppPlacementAllocator() |
| Modifier and Type | Method | Description |
|---|---|---|
ContainerRequest |
allocate(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey,
NodeType type,
SchedulerNode node) |
Notify container allocated.
|
boolean |
canAllocate(NodeType type,
SchedulerNode node) |
We can still have pending requirement for a given NodeType and node
|
boolean |
canDelayTo(java.lang.String resourceName) |
Can delay to give locality?
TODO: This should be moved out of AppPlacementAllocator
and should belong to specific delay scheduling policy impl.
|
org.apache.hadoop.yarn.api.records.ResourceRequest |
cloneResourceRequest(org.apache.hadoop.yarn.api.records.ResourceRequest request) |
|
int |
getOutstandingAsksCount(java.lang.String resourceName) |
Get #pending-allocations for given resourceName.
|
PendingAsk |
getPendingAsk(java.lang.String resourceName) |
Get pending ask for given resourceName.
|
java.lang.String |
getPrimaryRequestedNodePartition() |
It is possible that one request can accept multiple node partition,
So this method returns primary node partition for pending resource /
headroom calculation.
|
java.util.Map<java.lang.String,org.apache.hadoop.yarn.api.records.ResourceRequest> |
getResourceRequests() |
Get pending ResourceRequests by given schedulerRequestKey
|
org.apache.hadoop.yarn.api.records.SchedulingRequest |
getSchedulingRequest() |
Get pending SchedulingRequest.
|
int |
getUniqueLocationAsks() |
|
void |
initialize(AppSchedulingInfo appSchedulingInfo,
org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerRequestKey,
RMContext rmContext) |
Initialize this allocator, this will be called by Factory automatically.
|
boolean |
precheckNode(SchedulerNode schedulerNode,
SchedulingMode schedulingMode) |
|
boolean |
precheckNode(SchedulerNode schedulerNode,
SchedulingMode schedulingMode,
java.util.Optional<DiagnosticsCollector> dcOpt) |
Does this
AppPlacementAllocator accept resources on given node? |
void |
showRequests() |
Print human-readable requests to LOG debug.
|
PendingAskUpdateResult |
updatePendingAsk(java.util.Collection<org.apache.hadoop.yarn.api.records.ResourceRequest> requests,
boolean recoverPreemptedRequestForAContainer) |
Replace existing pending asks by the new requests
|
PendingAskUpdateResult |
updatePendingAsk(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerRequestKey,
org.apache.hadoop.yarn.api.records.SchedulingRequest schedulingRequest,
boolean recoverPreemptedRequestForAContainer) |
Replace existing pending asks by the new SchedulingRequest
|
getPlacementAttempt, getPreferredNodeIterator, incrementPlacementAttemptpublic void initialize(AppSchedulingInfo appSchedulingInfo, org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerRequestKey, RMContext rmContext)
AppPlacementAllocatorinitialize in class AppPlacementAllocator<N extends SchedulerNode>appSchedulingInfo - appSchedulingInfoschedulerRequestKey - schedulerRequestKeyrmContext - rmContextpublic PendingAskUpdateResult updatePendingAsk(java.util.Collection<org.apache.hadoop.yarn.api.records.ResourceRequest> requests, boolean recoverPreemptedRequestForAContainer)
AppPlacementAllocatorupdatePendingAsk in class AppPlacementAllocator<N extends SchedulerNode>requests - new asksrecoverPreemptedRequestForAContainer - if we're recovering resource
requests for preempted containerpublic PendingAskUpdateResult updatePendingAsk(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerRequestKey, org.apache.hadoop.yarn.api.records.SchedulingRequest schedulingRequest, boolean recoverPreemptedRequestForAContainer) throws org.apache.hadoop.yarn.exceptions.SchedulerInvalidResoureRequestException
AppPlacementAllocatorupdatePendingAsk in class AppPlacementAllocator<N extends SchedulerNode>schedulerRequestKey - scheduler request keyschedulingRequest - new asksrecoverPreemptedRequestForAContainer - if we're recovering resource
requests for preempted containerorg.apache.hadoop.yarn.exceptions.SchedulerInvalidResoureRequestExceptionpublic java.util.Map<java.lang.String,org.apache.hadoop.yarn.api.records.ResourceRequest> getResourceRequests()
AppPlacementAllocatorgetResourceRequests in class AppPlacementAllocator<N extends SchedulerNode>public PendingAsk getPendingAsk(java.lang.String resourceName)
AppPlacementAllocatorPendingAsk.ZEROgetPendingAsk in class AppPlacementAllocator<N extends SchedulerNode>resourceName - resourceNamepublic int getOutstandingAsksCount(java.lang.String resourceName)
AppPlacementAllocatorgetOutstandingAsksCount in class AppPlacementAllocator<N extends SchedulerNode>resourceName - resourceNamepublic org.apache.hadoop.yarn.api.records.ResourceRequest cloneResourceRequest(org.apache.hadoop.yarn.api.records.ResourceRequest request)
public boolean canAllocate(NodeType type, SchedulerNode node)
AppPlacementAllocatorcanAllocate in class AppPlacementAllocator<N extends SchedulerNode>type - Locality Typenode - which node we will allocate onpublic boolean canDelayTo(java.lang.String resourceName)
AppPlacementAllocatorcanDelayTo in class AppPlacementAllocator<N extends SchedulerNode>resourceName - resourceNamepublic boolean precheckNode(SchedulerNode schedulerNode, SchedulingMode schedulingMode, java.util.Optional<DiagnosticsCollector> dcOpt)
AppPlacementAllocatorAppPlacementAllocator accept resources on given node?precheckNode in class AppPlacementAllocator<N extends SchedulerNode>schedulerNode - schedulerNodeschedulingMode - schedulingModedcOpt - optional diagnostics collectorpublic boolean precheckNode(SchedulerNode schedulerNode, SchedulingMode schedulingMode)
precheckNode in class AppPlacementAllocator<N extends SchedulerNode>public java.lang.String getPrimaryRequestedNodePartition()
AppPlacementAllocatorgetPrimaryRequestedNodePartition in class AppPlacementAllocator<N extends SchedulerNode>public int getUniqueLocationAsks()
getUniqueLocationAsks in class AppPlacementAllocator<N extends SchedulerNode>public void showRequests()
AppPlacementAllocatorshowRequests in class AppPlacementAllocator<N extends SchedulerNode>public ContainerRequest allocate(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey, NodeType type, SchedulerNode node)
AppPlacementAllocatorallocate in class AppPlacementAllocator<N extends SchedulerNode>schedulerKey - SchedulerRequestKey for this ResourceRequesttype - Type of the allocationnode - Which node this container allocated onContainerRequest for more details.public org.apache.hadoop.yarn.api.records.SchedulingRequest getSchedulingRequest()
AppPlacementAllocatorgetSchedulingRequest in class AppPlacementAllocator<N extends SchedulerNode>Copyright © 2008–2025 Apache Software Foundation. All rights reserved.