@InterfaceAudience.LimitedPrivate(value="yarn") @InterfaceStability.Unstable public class FairScheduler extends Object implements ResourceScheduler
Modifier and Type | Field and Description |
---|---|
protected Map<ApplicationAttemptId,FSSchedulerApp> |
applications |
protected boolean |
assignMultiple |
static Resource |
CONTAINER_RESERVED |
protected long |
lastPreemptionUpdateTime |
protected int |
maxAssign |
protected double |
nodeLocalityThreshold |
protected boolean |
preemptionEnabled |
protected long |
preemptionInterval |
protected double |
rackLocalityThreshold |
protected boolean |
sizeBasedWeight |
protected long |
UPDATE_INTERVAL |
protected long |
waitTimeBeforeKill |
protected WeightAdjuster |
weightAdjuster |
Constructor and Description |
---|
FairScheduler() |
Modifier and Type | Method and Description |
---|---|
protected void |
addApplication(ApplicationAttemptId applicationAttemptId,
String queueName,
String user)
Add a new application to the scheduler, with a given id, queue name, and
user.
|
Allocation |
allocate(ApplicationAttemptId appAttemptId,
List<ResourceRequest> ask,
List<ContainerId> release,
List<String> blacklistAdditions,
List<String> blacklistRemovals)
The main api between the ApplicationMaster and the Scheduler.
|
boolean |
checkAccess(UserGroupInformation callerUGI,
QueueACL acl,
String queueName)
Check if the user has permission to perform the operation.
|
ResourceWeights |
getAppWeight(AppSchedulable app) |
Clock |
getClock() |
Resource |
getClusterCapacity() |
FairSchedulerConfiguration |
getConf() |
RMContainerTokenSecretManager |
getContainerTokenSecretManager() |
org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerEventLog |
getEventLog() |
Resource |
getIncrementResourceCapability() |
Resource |
getMaximumResourceCapability()
Get maximum allocatable
Resource . |
Resource |
getMinimumResourceCapability()
Get minimum allocatable
Resource . |
double |
getNodeLocalityThreshold() |
SchedulerNodeReport |
getNodeReport(NodeId nodeId)
Get node resource usage report.
|
int |
getNumClusterNodes()
Get the number of nodes available in the cluster.
|
QueueInfo |
getQueueInfo(String queueName,
boolean includeChildQueues,
boolean recursive)
Get queue information
|
QueueManager |
getQueueManager() |
List<QueueUserACLInfo> |
getQueueUserAclInfo()
Get acls for queues for current user.
|
double |
getRackLocalityThreshold() |
QueueMetrics |
getRootQueueMetrics()
Get the root queue for the scheduler.
|
FSSchedulerApp |
getSchedulerApp(ApplicationAttemptId appAttemptId) |
SchedulerAppReport |
getSchedulerAppInfo(ApplicationAttemptId appAttemptId)
Get the Scheduler app for a given app attempt Id.
|
void |
handle(SchedulerEvent event) |
protected void |
preemptResources(Collection<FSLeafQueue> scheds,
Resource toPreempt)
Preempt a quantity of resources from a list of QueueSchedulables.
|
protected void |
preemptTasksIfNecessary()
Check for queues that need tasks preempted, either because they have been
below their guaranteed share for minSharePreemptionTimeout or they have
been below half their fair share for the fairSharePreemptionTimeout.
|
void |
recover(RMStateStore.RMState state) |
void |
reinitialize(Configuration conf,
RMContext rmContext)
Re-initialize the
ResourceScheduler . |
protected Resource |
resToPreempt(FSLeafQueue sched,
long curTime)
Return the resource amount that this queue is allowed to preempt, if any.
|
protected void |
setClock(Clock clock) |
protected void |
update()
Recompute the internal variables used by the scheduler - per-job weights,
fair shares, deficits, minimum slot allocations, and amount of used and
required resources per job.
|
public static final Resource CONTAINER_RESERVED
protected long UPDATE_INTERVAL
protected long lastPreemptionUpdateTime
protected Map<ApplicationAttemptId,FSSchedulerApp> applications
protected long preemptionInterval
protected long waitTimeBeforeKill
protected boolean preemptionEnabled
protected boolean sizeBasedWeight
protected WeightAdjuster weightAdjuster
protected double nodeLocalityThreshold
protected double rackLocalityThreshold
protected boolean assignMultiple
protected int maxAssign
public FairSchedulerConfiguration getConf()
public QueueManager getQueueManager()
protected void update()
protected void preemptTasksIfNecessary()
protected void preemptResources(Collection<FSLeafQueue> scheds, Resource toPreempt)
protected Resource resToPreempt(FSLeafQueue sched, long curTime)
public RMContainerTokenSecretManager getContainerTokenSecretManager()
public ResourceWeights getAppWeight(AppSchedulable app)
public Resource getMinimumResourceCapability()
YarnScheduler
Resource
.getMinimumResourceCapability
in interface YarnScheduler
public Resource getIncrementResourceCapability()
public Resource getMaximumResourceCapability()
YarnScheduler
Resource
.getMaximumResourceCapability
in interface YarnScheduler
public double getNodeLocalityThreshold()
public double getRackLocalityThreshold()
public Resource getClusterCapacity()
public Clock getClock()
protected void setClock(Clock clock)
public org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerEventLog getEventLog()
protected void addApplication(ApplicationAttemptId applicationAttemptId, String queueName, String user)
public Allocation allocate(ApplicationAttemptId appAttemptId, List<ResourceRequest> ask, List<ContainerId> release, List<String> blacklistAdditions, List<String> blacklistRemovals)
YarnScheduler
allocate
in interface YarnScheduler
Allocation
for the applicationpublic SchedulerNodeReport getNodeReport(NodeId nodeId)
YarnScheduler
getNodeReport
in interface YarnScheduler
SchedulerNodeReport
for the node or null
if nodeId does not point to a defined node.public FSSchedulerApp getSchedulerApp(ApplicationAttemptId appAttemptId)
public SchedulerAppReport getSchedulerAppInfo(ApplicationAttemptId appAttemptId)
YarnScheduler
getSchedulerAppInfo
in interface YarnScheduler
appAttemptId
- the id of the application attemptpublic QueueMetrics getRootQueueMetrics()
YarnScheduler
getRootQueueMetrics
in interface YarnScheduler
public void handle(SchedulerEvent event)
handle
in interface EventHandler<SchedulerEvent>
public void recover(RMStateStore.RMState state) throws Exception
recover
in interface Recoverable
Exception
public void reinitialize(Configuration conf, RMContext rmContext) throws IOException
ResourceScheduler
ResourceScheduler
.reinitialize
in interface ResourceScheduler
conf
- configurationIOException
public QueueInfo getQueueInfo(String queueName, boolean includeChildQueues, boolean recursive) throws IOException
YarnScheduler
getQueueInfo
in interface YarnScheduler
queueName
- queue nameincludeChildQueues
- include child queues?recursive
- get children queues?IOException
public List<QueueUserACLInfo> getQueueUserAclInfo()
YarnScheduler
getQueueUserAclInfo
in interface YarnScheduler
public int getNumClusterNodes()
YarnScheduler
getNumClusterNodes
in interface YarnScheduler
public boolean checkAccess(UserGroupInformation callerUGI, QueueACL acl, String queueName)
YarnScheduler
QueueACL.ADMINISTER_QUEUE
permission,
this user can view/modify the applications in this queuecheckAccess
in interface YarnScheduler
true
if the user has the permission,
false
otherwiseCopyright © 2013 Apache Software Foundation. All rights reserved.