YARN-7591. NPE in async-scheduling mode of CapacityScheduler. (Tao Yang via wangda)
Change-Id: I67e086d6d35c3166ec0f6305490ea6527bd6d799
(cherry picked from commit 41796ea60a
)
This commit is contained in:
parent
850bd0ed7c
commit
c27a5ba65c
|
@ -1258,6 +1258,10 @@ public class CapacityScheduler extends
|
||||||
if (reservedContainer != null) {
|
if (reservedContainer != null) {
|
||||||
FiCaSchedulerApp reservedApplication = getCurrentAttemptForContainer(
|
FiCaSchedulerApp reservedApplication = getCurrentAttemptForContainer(
|
||||||
reservedContainer.getContainerId());
|
reservedContainer.getContainerId());
|
||||||
|
if (reservedApplication == null) {
|
||||||
|
LOG.error("Trying to schedule for a finished app, please double check.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Try to fulfill the reservation
|
// Try to fulfill the reservation
|
||||||
LOG.info(
|
LOG.info(
|
||||||
|
|
|
@ -1186,7 +1186,14 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
allocation.getSchedulingMode(), null);
|
allocation.getSchedulingMode(), null);
|
||||||
|
|
||||||
// Deduct resources that we can release
|
// Deduct resources that we can release
|
||||||
Resource usedResource = Resources.clone(getUser(username).getUsed(p));
|
User user = getUser(username);
|
||||||
|
if (user == null) {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("User " + username + " has been removed!");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Resource usedResource = Resources.clone(user.getUsed(p));
|
||||||
Resources.subtractFrom(usedResource,
|
Resources.subtractFrom(usedResource,
|
||||||
request.getTotalReleasedResource());
|
request.getTotalReleasedResource());
|
||||||
|
|
||||||
|
@ -1391,6 +1398,12 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
SchedulingMode schedulingMode, Resource userLimit) {
|
SchedulingMode schedulingMode, Resource userLimit) {
|
||||||
String user = application.getUser();
|
String user = application.getUser();
|
||||||
User queueUser = getUser(user);
|
User queueUser = getUser(user);
|
||||||
|
if (queueUser == null) {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("User " + user + " has been removed!");
|
||||||
|
}
|
||||||
|
return Resources.none();
|
||||||
|
}
|
||||||
|
|
||||||
// Compute user limit respect requested labels,
|
// Compute user limit respect requested labels,
|
||||||
// TODO, need consider headroom respect labels also
|
// TODO, need consider headroom respect labels also
|
||||||
|
@ -1485,6 +1498,12 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
try {
|
try {
|
||||||
readLock.lock();
|
readLock.lock();
|
||||||
User user = getUser(userName);
|
User user = getUser(userName);
|
||||||
|
if (user == null) {
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("User " + userName + " has been removed!");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
currentResourceLimits.setAmountNeededUnreserve(Resources.none());
|
currentResourceLimits.setAmountNeededUnreserve(Resources.none());
|
||||||
|
|
||||||
|
|
|
@ -321,6 +321,11 @@ public class FiCaSchedulerApp extends SchedulerApplicationAttempt {
|
||||||
RMContainer reservedContainerOnNode =
|
RMContainer reservedContainerOnNode =
|
||||||
schedulerContainer.getSchedulerNode().getReservedContainer();
|
schedulerContainer.getSchedulerNode().getReservedContainer();
|
||||||
if (reservedContainerOnNode != null) {
|
if (reservedContainerOnNode != null) {
|
||||||
|
// adding NP check as this proposal could not be allocated from reserved
|
||||||
|
// container in async-scheduling mode
|
||||||
|
if (allocation.getAllocateFromReservedContainer() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
RMContainer fromReservedContainer =
|
RMContainer fromReservedContainer =
|
||||||
allocation.getAllocateFromReservedContainer().getRmContainer();
|
allocation.getAllocateFromReservedContainer().getRmContainer();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue