public class SingleConstraintAppPlacementAllocator<N extends SchedulerNode> extends AppPlacementAllocator<N>
appSchedulingInfo, rmContext, schedulerRequestKey
Constructor and Description |
---|
SingleConstraintAppPlacementAllocator() |
Modifier and Type | Method and 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(String resourceName)
Can delay to give locality?
TODO: This should be moved out of AppPlacementAllocator
and should belong to specific delay scheduling policy impl.
|
int |
getOutstandingAsksCount(String resourceName)
Get #pending-allocations for given resourceName.
|
PendingAsk |
getPendingAsk(String resourceName)
Get pending ask for given resourceName.
|
Iterator<N> |
getPreferredNodeIterator(CandidateNodeSet<N> candidateNodeSet)
Get iterator of preferred node depends on requirement and/or availability.
|
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.
|
Map<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)
Does this
AppPlacementAllocator accept resources on given node? |
void |
showRequests()
Print human-readable requests to LOG debug.
|
PendingAskUpdateResult |
updatePendingAsk(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 newSchedulingRequest,
boolean recoverPreemptedRequestForAContainer)
Replace existing pending asks by the new SchedulingRequest
|
public SingleConstraintAppPlacementAllocator()
public Iterator<N> getPreferredNodeIterator(CandidateNodeSet<N> candidateNodeSet)
AppPlacementAllocator
getPreferredNodeIterator
in class AppPlacementAllocator<N extends SchedulerNode>
candidateNodeSet
- input CandidateNodeSetpublic PendingAskUpdateResult updatePendingAsk(Collection<org.apache.hadoop.yarn.api.records.ResourceRequest> requests, boolean recoverPreemptedRequestForAContainer)
AppPlacementAllocator
updatePendingAsk
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 newSchedulingRequest, boolean recoverPreemptedRequestForAContainer)
AppPlacementAllocator
updatePendingAsk
in class AppPlacementAllocator<N extends SchedulerNode>
schedulerRequestKey
- scheduler request keynewSchedulingRequest
- new asksrecoverPreemptedRequestForAContainer
- if we're recovering resource
requests for preempted containerpublic Map<String,org.apache.hadoop.yarn.api.records.ResourceRequest> getResourceRequests()
AppPlacementAllocator
getResourceRequests
in class AppPlacementAllocator<N extends SchedulerNode>
public PendingAsk getPendingAsk(String resourceName)
AppPlacementAllocator
PendingAsk.ZERO
getPendingAsk
in class AppPlacementAllocator<N extends SchedulerNode>
resourceName
- resourceNamepublic int getOutstandingAsksCount(String resourceName)
AppPlacementAllocator
getOutstandingAsksCount
in class AppPlacementAllocator<N extends SchedulerNode>
resourceName
- resourceNamepublic ContainerRequest allocate(org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerKey, NodeType type, SchedulerNode node)
AppPlacementAllocator
allocate
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 boolean canAllocate(NodeType type, SchedulerNode node)
AppPlacementAllocator
canAllocate
in class AppPlacementAllocator<N extends SchedulerNode>
type
- Locality Typenode
- which node we will allocate onpublic boolean canDelayTo(String resourceName)
AppPlacementAllocator
canDelayTo
in class AppPlacementAllocator<N extends SchedulerNode>
resourceName
- resourceNamepublic boolean precheckNode(SchedulerNode schedulerNode, SchedulingMode schedulingMode)
AppPlacementAllocator
AppPlacementAllocator
accept resources on given node?precheckNode
in class AppPlacementAllocator<N extends SchedulerNode>
schedulerNode
- schedulerNodeschedulingMode
- schedulingModepublic String getPrimaryRequestedNodePartition()
AppPlacementAllocator
getPrimaryRequestedNodePartition
in class AppPlacementAllocator<N extends SchedulerNode>
public int getUniqueLocationAsks()
getUniqueLocationAsks
in class AppPlacementAllocator<N extends SchedulerNode>
public void showRequests()
AppPlacementAllocator
showRequests
in class AppPlacementAllocator<N extends SchedulerNode>
public org.apache.hadoop.yarn.api.records.SchedulingRequest getSchedulingRequest()
AppPlacementAllocator
getSchedulingRequest
in class AppPlacementAllocator<N extends SchedulerNode>
public void initialize(AppSchedulingInfo appSchedulingInfo, org.apache.hadoop.yarn.server.scheduler.SchedulerRequestKey schedulerRequestKey, RMContext rmContext)
AppPlacementAllocator
initialize
in class AppPlacementAllocator<N extends SchedulerNode>
appSchedulingInfo
- appSchedulingInfoschedulerRequestKey
- schedulerRequestKeyrmContext
- rmContextCopyright © 2008–2022 Apache Software Foundation. All rights reserved.