@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()
YarnSchedulerResource.getMinimumResourceCapability in interface YarnSchedulerpublic Resource getIncrementResourceCapability()
public Resource getMaximumResourceCapability()
YarnSchedulerResource.getMaximumResourceCapability in interface YarnSchedulerpublic 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)
YarnSchedulerallocate in interface YarnSchedulerAllocation for the applicationpublic SchedulerNodeReport getNodeReport(NodeId nodeId)
YarnSchedulergetNodeReport in interface YarnSchedulerSchedulerNodeReport for the node or null
if nodeId does not point to a defined node.public FSSchedulerApp getSchedulerApp(ApplicationAttemptId appAttemptId)
public SchedulerAppReport getSchedulerAppInfo(ApplicationAttemptId appAttemptId)
YarnSchedulergetSchedulerAppInfo in interface YarnSchedulerappAttemptId - the id of the application attemptpublic QueueMetrics getRootQueueMetrics()
YarnSchedulergetRootQueueMetrics in interface YarnSchedulerpublic void handle(SchedulerEvent event)
handle in interface EventHandler<SchedulerEvent>public void recover(RMStateStore.RMState state) throws Exception
recover in interface RecoverableExceptionpublic void reinitialize(Configuration conf, RMContext rmContext) throws IOException
ResourceSchedulerResourceScheduler.reinitialize in interface ResourceSchedulerconf - configurationIOExceptionpublic QueueInfo getQueueInfo(String queueName, boolean includeChildQueues, boolean recursive) throws IOException
YarnSchedulergetQueueInfo in interface YarnSchedulerqueueName - queue nameincludeChildQueues - include child queues?recursive - get children queues?IOExceptionpublic List<QueueUserACLInfo> getQueueUserAclInfo()
YarnSchedulergetQueueUserAclInfo in interface YarnSchedulerpublic int getNumClusterNodes()
YarnSchedulergetNumClusterNodes in interface YarnSchedulerpublic boolean checkAccess(UserGroupInformation callerUGI, QueueACL acl, String queueName)
YarnSchedulerQueueACL.ADMINISTER_QUEUE permission,
this user can view/modify the applications in this queuecheckAccess in interface YarnSchedulertrue if the user has the permission,
false otherwiseCopyright © 2013 Apache Software Foundation. All rights reserved.