|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler
@InterfaceAudience.LimitedPrivate(value="yarn") @InterfaceStability.Unstable public class FairScheduler
A scheduler that schedules resources between a set of queues. The scheduler keeps track of the resources used by each queue, and attempts to maintain fairness by scheduling tasks at queues whose allocations are farthest below an ideal fair distribution. The fair scheduler supports hierarchical queues. All queues descend from a queue named "root". Available resources are distributed among the children of the root queue in the typical fair scheduling fashion. Then, the children distribute the resources assigned to them to their children in the same fashion. Applications may only be scheduled on leaf queues. Queues can be specified as children of other queues by placing them as sub-elements of their parents in the fair scheduler configuration file. A queue's name starts with the names of its parents, with periods as separators. So a queue named "queue1" under the root named, would be referred to as "root.queue1", and a queue named "queue2" under a queue named "parent1" would be referred to as "root.parent1.queue2".
| Field Summary | |
|---|---|
protected Map<org.apache.hadoop.yarn.api.records.ApplicationAttemptId,FSSchedulerApp> |
applications
|
protected boolean |
assignMultiple
|
static org.apache.hadoop.yarn.api.records.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 Summary | |
|---|---|
FairScheduler()
|
|
| Method Summary | |
|---|---|
protected void |
addApplication(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId,
String queueName,
String user)
Add a new application to the scheduler, with a given id, queue name, and user. |
Allocation |
allocate(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId,
List<org.apache.hadoop.yarn.api.records.ResourceRequest> ask,
List<org.apache.hadoop.yarn.api.records.ContainerId> release,
List<String> blacklistAdditions,
List<String> blacklistRemovals)
The main api between the ApplicationMaster and the Scheduler. |
boolean |
checkAccess(org.apache.hadoop.security.UserGroupInformation callerUGI,
org.apache.hadoop.yarn.api.records.QueueACL acl,
String queueName)
Check if the user has permission to perform the operation. |
ResourceWeights |
getAppWeight(AppSchedulable app)
|
org.apache.hadoop.yarn.util.Clock |
getClock()
|
org.apache.hadoop.yarn.api.records.Resource |
getClusterCapacity()
|
FairSchedulerConfiguration |
getConf()
|
RMContainerTokenSecretManager |
getContainerTokenSecretManager()
|
org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerEventLog |
getEventLog()
|
org.apache.hadoop.yarn.api.records.Resource |
getIncrementResourceCapability()
|
org.apache.hadoop.yarn.api.records.Resource |
getMaximumResourceCapability()
Get maximum allocatable Resource. |
org.apache.hadoop.yarn.api.records.Resource |
getMinimumResourceCapability()
Get minimum allocatable Resource. |
double |
getNodeLocalityThreshold()
|
SchedulerNodeReport |
getNodeReport(org.apache.hadoop.yarn.api.records.NodeId nodeId)
Get node resource usage report. |
int |
getNumClusterNodes()
Get the number of nodes available in the cluster. |
org.apache.hadoop.yarn.api.records.QueueInfo |
getQueueInfo(String queueName,
boolean includeChildQueues,
boolean recursive)
Get queue information |
QueueManager |
getQueueManager()
|
List<org.apache.hadoop.yarn.api.records.QueueUserACLInfo> |
getQueueUserAclInfo()
Get acls for queues for current user. |
double |
getRackLocalityThreshold()
|
QueueMetrics |
getRootQueueMetrics()
Get the root queue for the scheduler. |
FSSchedulerApp |
getSchedulerApp(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId)
|
SchedulerAppReport |
getSchedulerAppInfo(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId)
Get the Scheduler app for a given app attempt Id. |
void |
handle(SchedulerEvent event)
|
protected void |
preemptResources(Collection<FSLeafQueue> scheds,
org.apache.hadoop.yarn.api.records.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(org.apache.hadoop.conf.Configuration conf,
RMContext rmContext)
Re-initialize the ResourceScheduler. |
protected org.apache.hadoop.yarn.api.records.Resource |
resToPreempt(FSLeafQueue sched,
long curTime)
Return the resource amount that this queue is allowed to preempt, if any. |
protected void |
setClock(org.apache.hadoop.yarn.util.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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final org.apache.hadoop.yarn.api.records.Resource CONTAINER_RESERVED
protected long UPDATE_INTERVAL
protected long lastPreemptionUpdateTime
protected Map<org.apache.hadoop.yarn.api.records.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
| Constructor Detail |
|---|
public FairScheduler()
| Method Detail |
|---|
public FairSchedulerConfiguration getConf()
public QueueManager getQueueManager()
protected void update()
protected void preemptTasksIfNecessary()
protected void preemptResources(Collection<FSLeafQueue> scheds,
org.apache.hadoop.yarn.api.records.Resource toPreempt)
protected org.apache.hadoop.yarn.api.records.Resource resToPreempt(FSLeafQueue sched,
long curTime)
public RMContainerTokenSecretManager getContainerTokenSecretManager()
public ResourceWeights getAppWeight(AppSchedulable app)
public org.apache.hadoop.yarn.api.records.Resource getMinimumResourceCapability()
YarnSchedulerResource.
getMinimumResourceCapability in interface YarnSchedulerpublic org.apache.hadoop.yarn.api.records.Resource getIncrementResourceCapability()
public org.apache.hadoop.yarn.api.records.Resource getMaximumResourceCapability()
YarnSchedulerResource.
getMaximumResourceCapability in interface YarnSchedulerpublic double getNodeLocalityThreshold()
public double getRackLocalityThreshold()
public org.apache.hadoop.yarn.api.records.Resource getClusterCapacity()
public org.apache.hadoop.yarn.util.Clock getClock()
protected void setClock(org.apache.hadoop.yarn.util.Clock clock)
public org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerEventLog getEventLog()
protected void addApplication(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId,
String queueName,
String user)
public Allocation allocate(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId,
List<org.apache.hadoop.yarn.api.records.ResourceRequest> ask,
List<org.apache.hadoop.yarn.api.records.ContainerId> release,
List<String> blacklistAdditions,
List<String> blacklistRemovals)
YarnScheduler
allocate in interface YarnSchedulerAllocation for the applicationpublic SchedulerNodeReport getNodeReport(org.apache.hadoop.yarn.api.records.NodeId nodeId)
YarnScheduler
getNodeReport in interface YarnSchedulerSchedulerNodeReport for the node or null
if nodeId does not point to a defined node.public FSSchedulerApp getSchedulerApp(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId)
public SchedulerAppReport getSchedulerAppInfo(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId)
YarnScheduler
getSchedulerAppInfo in interface YarnSchedulerappAttemptId - the id of the application attempt
public QueueMetrics getRootQueueMetrics()
YarnScheduler
getRootQueueMetrics in interface YarnSchedulerpublic void handle(SchedulerEvent event)
handle in interface org.apache.hadoop.yarn.event.EventHandler<SchedulerEvent>
public void recover(RMStateStore.RMState state)
throws Exception
recover in interface RecoverableException
public void reinitialize(org.apache.hadoop.conf.Configuration conf,
RMContext rmContext)
throws IOException
ResourceSchedulerResourceScheduler.
reinitialize in interface ResourceSchedulerconf - configuration
IOException
public org.apache.hadoop.yarn.api.records.QueueInfo getQueueInfo(String queueName,
boolean includeChildQueues,
boolean recursive)
throws IOException
YarnScheduler
getQueueInfo in interface YarnSchedulerqueueName - queue nameincludeChildQueues - include child queues?recursive - get children queues?
IOExceptionpublic List<org.apache.hadoop.yarn.api.records.QueueUserACLInfo> getQueueUserAclInfo()
YarnScheduler
getQueueUserAclInfo in interface YarnSchedulerpublic int getNumClusterNodes()
YarnScheduler
getNumClusterNodes in interface YarnScheduler
public boolean checkAccess(org.apache.hadoop.security.UserGroupInformation callerUGI,
org.apache.hadoop.yarn.api.records.QueueACL acl,
String queueName)
YarnSchedulerQueueACL.ADMINISTER_QUEUE permission,
this user can view/modify the applications in this queue
checkAccess in interface YarnSchedulertrue if the user has the permission,
false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||