|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler<FSAppAttempt,FSSchedulerNode>
org.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".
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service |
|---|
org.apache.hadoop.service.Service.STATE |
| Field Summary | |
|---|---|
protected boolean |
assignMultiple
|
static org.apache.hadoop.yarn.api.records.Resource |
CONTAINER_RESERVED
|
protected boolean |
continuousSchedulingEnabled
|
protected int |
continuousSchedulingSleepMs
|
protected long |
lastPreemptionUpdateTime
|
protected int |
maxAssign
|
protected long |
nodeLocalityDelayMs
|
protected double |
nodeLocalityThreshold
|
protected boolean |
preemptionEnabled
|
protected long |
preemptionInterval
|
protected float |
preemptionUtilizationThreshold
|
protected long |
rackLocalityDelayMs
|
protected double |
rackLocalityThreshold
|
protected boolean |
sizeBasedWeight
|
protected long |
THREAD_JOIN_TIMEOUT_MS
|
protected long |
updateInterval
|
protected long |
waitTimeBeforeKill
|
protected WeightAdjuster |
weightAdjuster
|
| Fields inherited from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler |
|---|
applications, clusterResource, EMPTY_ALLOCATION, EMPTY_CONTAINER_LIST, maximumAllocation, minimumAllocation, nmExpireInterval, nodes, rmContext |
| Constructor Summary | |
|---|---|
FairScheduler()
|
|
| Method Summary | |
|---|---|
protected void |
addApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId,
String queueName,
String user,
boolean isAppRecovering)
Add a new application to the scheduler, with a given id, queue name, and user. |
protected void |
addApplicationAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId,
boolean transferStateFromPreviousAttempt,
boolean isAttemptRecovering)
Add a new application attempt to the scheduler. |
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. |
protected void |
completedContainer(RMContainer rmContainer,
org.apache.hadoop.yarn.api.records.ContainerStatus containerStatus,
RMContainerEventType event)
Clean up a completed container. |
AllocationConfiguration |
getAllocationConfiguration()
|
List<org.apache.hadoop.yarn.api.records.ApplicationAttemptId> |
getAppsInQueue(String queueName)
Gets the apps under a given queue |
ResourceWeights |
getAppWeight(FSAppAttempt app)
|
org.apache.hadoop.yarn.util.Clock |
getClock()
|
FairSchedulerConfiguration |
getConf()
|
RMContainerTokenSecretManager |
getContainerTokenSecretManager()
|
int |
getContinuousSchedulingSleepMs()
|
org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerEventLog |
getEventLog()
|
org.apache.hadoop.yarn.api.records.Resource |
getIncrementResourceCapability()
|
long |
getNodeLocalityDelayMs()
|
double |
getNodeLocalityThreshold()
|
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. |
long |
getRackLocalityDelayMs()
|
double |
getRackLocalityThreshold()
|
static org.apache.hadoop.yarn.util.resource.ResourceCalculator |
getResourceCalculator()
|
QueueMetrics |
getRootQueueMetrics()
Get the root queue for the scheduler. |
FSAppAttempt |
getSchedulerApp(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId)
|
EnumSet<org.apache.hadoop.yarn.proto.YarnServiceProtos.SchedulerResourceTypes> |
getSchedulingResourceTypes()
Return a collection of the resource types that are considered when scheduling |
void |
handle(SchedulerEvent event)
|
boolean |
isContinuousSchedulingEnabled()
|
String |
moveApplication(org.apache.hadoop.yarn.api.records.ApplicationId appId,
String queueName)
Moves the given application to the given queue |
protected void |
preemptResources(org.apache.hadoop.yarn.api.records.Resource toPreempt)
Preempt a quantity of resources. |
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 their fair share threshold 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. |
void |
serviceInit(org.apache.hadoop.conf.Configuration conf)
|
void |
serviceStart()
|
void |
serviceStop()
|
void |
setRMContext(RMContext rmContext)
Set RMContext for ResourceScheduler. |
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. |
void |
updateNodeResource(RMNode nm,
org.apache.hadoop.yarn.api.records.ResourceOption resourceOption)
Process resource update on a node and update Queue. |
protected void |
warnOrKillContainer(RMContainer container)
|
| Methods inherited from class org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler |
|---|
addQueue, containerLaunchedOnNode, createReleaseCache, getApplicationAttempt, getAppResourceUsageReport, getClusterResource, getCurrentAttemptForContainer, getMaximumResourceCapability, getMinimumResourceCapability, getNodeReport, getPlanQueues, getRMContainer, getSchedulerAppInfo, getSchedulerApplications, getSchedulerNode, getTransferredContainers, killAllAppsInQueue, moveAllApps, recoverContainersOnNode, recoverResourceRequestForContainer, releaseContainers, removeQueue, setEntitlement |
| Methods inherited from class org.apache.hadoop.service.AbstractService |
|---|
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final org.apache.hadoop.yarn.api.records.Resource CONTAINER_RESERVED
protected long updateInterval
protected final long THREAD_JOIN_TIMEOUT_MS
protected long lastPreemptionUpdateTime
protected boolean preemptionEnabled
protected float preemptionUtilizationThreshold
protected long preemptionInterval
protected long waitTimeBeforeKill
protected boolean sizeBasedWeight
protected WeightAdjuster weightAdjuster
protected boolean continuousSchedulingEnabled
protected int continuousSchedulingSleepMs
protected double nodeLocalityThreshold
protected double rackLocalityThreshold
protected long nodeLocalityDelayMs
protected long rackLocalityDelayMs
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(org.apache.hadoop.yarn.api.records.Resource toPreempt)
protected void warnOrKillContainer(RMContainer container)
protected org.apache.hadoop.yarn.api.records.Resource resToPreempt(FSLeafQueue sched,
long curTime)
public RMContainerTokenSecretManager getContainerTokenSecretManager()
public ResourceWeights getAppWeight(FSAppAttempt app)
public org.apache.hadoop.yarn.api.records.Resource getIncrementResourceCapability()
public double getNodeLocalityThreshold()
public double getRackLocalityThreshold()
public long getNodeLocalityDelayMs()
public long getRackLocalityDelayMs()
public boolean isContinuousSchedulingEnabled()
public int getContinuousSchedulingSleepMs()
public org.apache.hadoop.yarn.util.Clock getClock()
public org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairSchedulerEventLog getEventLog()
protected void addApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId,
String queueName,
String user,
boolean isAppRecovering)
protected void addApplicationAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId,
boolean transferStateFromPreviousAttempt,
boolean isAttemptRecovering)
protected void completedContainer(RMContainer rmContainer,
org.apache.hadoop.yarn.api.records.ContainerStatus containerStatus,
RMContainerEventType event)
completedContainer in class AbstractYarnScheduler<FSAppAttempt,FSSchedulerNode>
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
Allocation for the applicationpublic FSAppAttempt getSchedulerApp(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId)
public static org.apache.hadoop.yarn.util.resource.ResourceCalculator getResourceCalculator()
public QueueMetrics getRootQueueMetrics()
YarnScheduler
public void handle(SchedulerEvent event)
public void recover(RMStateStore.RMState state)
throws Exception
Exceptionpublic void setRMContext(RMContext rmContext)
ResourceSchedulerResourceScheduler.
This method should be called immediately after instantiating
a scheduler once.
rmContext - created by ResourceManager
public void serviceInit(org.apache.hadoop.conf.Configuration conf)
throws Exception
serviceInit in class AbstractYarnScheduler<FSAppAttempt,FSSchedulerNode>Exception
public void serviceStart()
throws Exception
serviceStart in class org.apache.hadoop.service.AbstractServiceException
public void serviceStop()
throws Exception
serviceStop in class org.apache.hadoop.service.AbstractServiceException
public void reinitialize(org.apache.hadoop.conf.Configuration conf,
RMContext rmContext)
throws IOException
ResourceSchedulerResourceScheduler.
conf - configuration
IOException
public org.apache.hadoop.yarn.api.records.QueueInfo getQueueInfo(String queueName,
boolean includeChildQueues,
boolean recursive)
throws IOException
YarnScheduler
queueName - queue nameincludeChildQueues - include child queues?recursive - get children queues?
IOExceptionpublic List<org.apache.hadoop.yarn.api.records.QueueUserACLInfo> getQueueUserAclInfo()
YarnScheduler
public int getNumClusterNodes()
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
true if the user has the permission,
false otherwisepublic AllocationConfiguration getAllocationConfiguration()
public List<org.apache.hadoop.yarn.api.records.ApplicationAttemptId> getAppsInQueue(String queueName)
YarnScheduler
queueName - the name of the queue.
public String moveApplication(org.apache.hadoop.yarn.api.records.ApplicationId appId,
String queueName)
throws org.apache.hadoop.yarn.exceptions.YarnException
YarnScheduler
moveApplication in interface YarnSchedulermoveApplication in class AbstractYarnScheduler<FSAppAttempt,FSSchedulerNode>org.apache.hadoop.yarn.exceptions.YarnException - if the move cannot be carried out
public void updateNodeResource(RMNode nm,
org.apache.hadoop.yarn.api.records.ResourceOption resourceOption)
updateNodeResource in class AbstractYarnScheduler<FSAppAttempt,FSSchedulerNode>public EnumSet<org.apache.hadoop.yarn.proto.YarnServiceProtos.SchedulerResourceTypes> getSchedulingResourceTypes()
getSchedulingResourceTypes in interface YarnSchedulergetSchedulingResourceTypes in class AbstractYarnScheduler<FSAppAttempt,FSSchedulerNode>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||