[ https://issues.apache.org/jira/browse/YARN-7561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
wuchang updated YARN-7561: -------------------------- Description: I am studying the FairScheduler source cod of yarn 2.7.3. By the code of class FSAppAttempt: {code} public boolean hasContainerForNode(Priority prio, FSSchedulerNode node) { ResourceRequest anyRequest = getResourceRequest(prio, ResourceRequest.ANY); ResourceRequest rackRequest = getResourceRequest(prio, node.getRackName()); ResourceRequest nodeRequest = getResourceRequest(prio, node.getNodeName()); return // There must be outstanding requests at the given priority: anyRequest != null && anyRequest.getNumContainers() > 0 && // If locality relaxation is turned off at *-level, there must be a // non-zero request for the node's rack: (anyRequest.getRelaxLocality() || (rackRequest != null && rackRequest.getNumContainers() > 0)) && // If locality relaxation is turned off at rack-level, there must be a // non-zero request at the node: (rackRequest == null || rackRequest.getRelaxLocality() || (nodeRequest != null && nodeRequest.getNumContainers() > 0)) && // The requested container must be able to fit on the node: Resources.lessThanOrEqual(RESOURCE_CALCULATOR, null, anyRequest.getCapability(), node.getRMNode().getTotalCapability()); } {code} I really cannot understand why when there is no anyRequest , *hasContainerForNode()* return false directly without considering whether there is NODE_LOCAL or RACK_LOCAL requests. And , *AppSchedulingInfo.allocateNodeLocal()* and *AppSchedulingInfo.allocateRackLocal()* will also decrease the number of containers for ResourceRequest.ANY, this is another place where I feel confused. Really thanks for some prompt. was: I am studying the FairScheduler source cod of yarn 2.7.3. By the code of class FSAppAttempt: {code} public boolean hasContainerForNode(Priority prio, FSSchedulerNode node) { ResourceRequest anyRequest = getResourceRequest(prio, ResourceRequest.ANY); ResourceRequest rackRequest = getResourceRequest(prio, node.getRackName()); ResourceRequest nodeRequest = getResourceRequest(prio, node.getNodeName()); return // There must be outstanding requests at the given priority: anyRequest != null && anyRequest.getNumContainers() > 0 && // If locality relaxation is turned off at *-level, there must be a // non-zero request for the node's rack: (anyRequest.getRelaxLocality() || (rackRequest != null && rackRequest.getNumContainers() > 0)) && // If locality relaxation is turned off at rack-level, there must be a // non-zero request at the node: (rackRequest == null || rackRequest.getRelaxLocality() || (nodeRequest != null && nodeRequest.getNumContainers() > 0)) && // The requested container must be able to fit on the node: Resources.lessThanOrEqual(RESOURCE_CALCULATOR, null, anyRequest.getCapability(), node.getRMNode().getTotalCapability()); } {code} I really cannot understand why when there is no anyRequest , *hasContainerForNode()* return false directly without considering where there is NODE_LOCAL or RACK_LOCAL requests, and , *AppSchedulingInfo.allocateNodeLocal()* and *AppSchedulingInfo.allocateRackLocal()* will also decrease the number of containers for ResourceRequest.ANY. Really thanks for some prompt. > Why hasContainerForNode return false directly when there is no request of ANY > locality? > --------------------------------------------------------------------------------------- > > Key: YARN-7561 > URL: https://issues.apache.org/jira/browse/YARN-7561 > Project: Hadoop YARN > Issue Type: Task > Components: fairscheduler > Affects Versions: 2.7.3 > Reporter: wuchang > > I am studying the FairScheduler source cod of yarn 2.7.3. > By the code of class FSAppAttempt: > {code} > public boolean hasContainerForNode(Priority prio, FSSchedulerNode node) { > ResourceRequest anyRequest = getResourceRequest(prio, > ResourceRequest.ANY); > ResourceRequest rackRequest = getResourceRequest(prio, > node.getRackName()); > ResourceRequest nodeRequest = getResourceRequest(prio, > node.getNodeName()); > return > // There must be outstanding requests at the given priority: > anyRequest != null && anyRequest.getNumContainers() > 0 && > // If locality relaxation is turned off at *-level, there must be > a > // non-zero request for the node's rack: > (anyRequest.getRelaxLocality() || > (rackRequest != null && rackRequest.getNumContainers() > 0)) > && > // If locality relaxation is turned off at rack-level, there must > be a > // non-zero request at the node: > (rackRequest == null || rackRequest.getRelaxLocality() || > (nodeRequest != null && nodeRequest.getNumContainers() > 0)) > && > // The requested container must be able to fit on the node: > Resources.lessThanOrEqual(RESOURCE_CALCULATOR, null, > anyRequest.getCapability(), > node.getRMNode().getTotalCapability()); > } > {code} > I really cannot understand why when there is no anyRequest , > *hasContainerForNode()* return false directly without considering whether > there is NODE_LOCAL or RACK_LOCAL requests. > And , *AppSchedulingInfo.allocateNodeLocal()* and > *AppSchedulingInfo.allocateRackLocal()* will also decrease the number of > containers for ResourceRequest.ANY, this is another place where I feel > confused. > Really thanks for some prompt. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org