YARN-10226. NPE in Capacity Scheduler while using %primary_group queue mapping. Contributed by Peter Bacsko.
This commit is contained in:
parent
e2c87b7917
commit
6fb29d0f17
@ -161,17 +161,19 @@ public class UserGroupMappingPlacementRule extends PlacementRule {
|
|||||||
String group =
|
String group =
|
||||||
CapacitySchedulerConfiguration.ROOT + "." + getPrimaryGroup(user);
|
CapacitySchedulerConfiguration.ROOT + "." + getPrimaryGroup(user);
|
||||||
|
|
||||||
CSQueue parent = queueManager.getQueue(mapping.getParentQueue());
|
String parent = mapping.getParentQueue();
|
||||||
|
CSQueue groupQueue = queueManager.getQueue(group);
|
||||||
|
|
||||||
if (parent instanceof ManagedParentQueue) {
|
if (parent != null) {
|
||||||
return getPlacementContext(mapping, group);
|
CSQueue parentQueue = queueManager.getQueue(parent);
|
||||||
} else {
|
|
||||||
CSQueue queue = this.queueManager.getQueue(group);
|
if (parentQueue instanceof ManagedParentQueue) {
|
||||||
if ( queue != null) {
|
return getPlacementContext(mapping, group);
|
||||||
return getPlacementContext(mapping, queue.getQueuePath());
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return groupQueue == null ? null : getPlacementContext(mapping, group);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return groupQueue == null ? null : getPlacementContext(mapping, group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ public class TestUserGroupMappingPlacementRule {
|
|||||||
when(queueManager.getQueue("bsubgroup2")).thenReturn(bsubgroup2);
|
when(queueManager.getQueue("bsubgroup2")).thenReturn(bsubgroup2);
|
||||||
when(queueManager.getQueue("asubgroup2")).thenReturn(asubgroup2);
|
when(queueManager.getQueue("asubgroup2")).thenReturn(asubgroup2);
|
||||||
when(queueManager.getQueue("managedParent")).thenReturn(managedParent);
|
when(queueManager.getQueue("managedParent")).thenReturn(managedParent);
|
||||||
|
when(queueManager.getQueue(null)).thenThrow(new NullPointerException());
|
||||||
|
|
||||||
when(queueManager.getQueue("root.agroup")).thenReturn(agroup);
|
when(queueManager.getQueue("root.agroup")).thenReturn(agroup);
|
||||||
when(queueManager.getQueue("root.bsubgroup2")).thenReturn(bsubgroup2);
|
when(queueManager.getQueue("root.bsubgroup2")).thenReturn(bsubgroup2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user