YARN-10578. Fix Auto Queue Creation parent handling. Contributed by Andras Gyori

This commit is contained in:
Szilard Nemeth 2021-01-20 15:22:44 +01:00
parent 4b5bc05a78
commit cfe6e1f7da
4 changed files with 14 additions and 38 deletions

View File

@ -154,11 +154,6 @@ public enum CapacityConfigType {
// is it a dynamic queue? // is it a dynamic queue?
private boolean dynamicQueue = false; private boolean dynamicQueue = false;
// When this queue has application submit to?
// This property only applies to dynamic queue,
// and will be used to check when the queue need to be removed.
private long lastSubmittedTimestamp;
public AbstractCSQueue(CapacitySchedulerContext cs, public AbstractCSQueue(CapacitySchedulerContext cs,
String queueName, CSQueue parent, CSQueue old) throws IOException { String queueName, CSQueue parent, CSQueue old) throws IOException {
this(cs, cs.getConfiguration(), queueName, parent, old); this(cs, cs.getConfiguration(), queueName, parent, old);
@ -1633,18 +1628,4 @@ public void setDynamicQueue(boolean dynamicQueue) {
writeLock.unlock(); writeLock.unlock();
} }
} }
public long getLastSubmittedTimestamp() {
return lastSubmittedTimestamp;
}
// "Tab" the queue, so this queue won't be removed because of idle timeout.
public void signalToSubmitToQueue() {
writeLock.lock();
try {
this.lastSubmittedTimestamp = System.currentTimeMillis();
} finally {
writeLock.unlock();
}
}
} }

View File

@ -343,7 +343,7 @@ void initScheduler(Configuration configuration) throws
this.queueManager.setCapacitySchedulerContext(this); this.queueManager.setCapacitySchedulerContext(this);
this.autoQueueHandler = new CapacitySchedulerAutoQueueHandler( this.autoQueueHandler = new CapacitySchedulerAutoQueueHandler(
this.queueManager, this.conf); this.queueManager);
this.workflowPriorityMappingsMgr = new WorkflowPriorityMappingsManager(); this.workflowPriorityMappingsMgr = new WorkflowPriorityMappingsManager();
@ -3380,26 +3380,25 @@ private LeafQueue autoCreateLeafQueue(
if (!StringUtils.isEmpty(parentQueueName)) { if (!StringUtils.isEmpty(parentQueueName)) {
CSQueue parentQueue = getQueue(parentQueueName); CSQueue parentQueue = getQueue(parentQueueName);
if (parentQueue == null) { if (parentQueue != null &&
throw new SchedulerDynamicEditException( conf.isAutoCreateChildQueueEnabled(parentQueue.getQueuePath())) {
"Could not auto-create leaf queue for " + leafQueueName
+ ". Queue mapping specifies an invalid parent queue "
+ "which does not exist " + parentQueueName);
}
if (conf.isAutoCreateChildQueueEnabled(parentQueue.getQueuePath())) {
// Case 1: Handle ManagedParentQueue // Case 1: Handle ManagedParentQueue
AutoCreatedLeafQueue autoCreatedLeafQueue = null;
ManagedParentQueue autoCreateEnabledParentQueue = ManagedParentQueue autoCreateEnabledParentQueue =
(ManagedParentQueue) parentQueue; (ManagedParentQueue) parentQueue;
autoCreatedLeafQueue = new AutoCreatedLeafQueue(this, leafQueueName, AutoCreatedLeafQueue autoCreatedLeafQueue =
autoCreateEnabledParentQueue); new AutoCreatedLeafQueue(
this, leafQueueName, autoCreateEnabledParentQueue);
addQueue(autoCreatedLeafQueue); addQueue(autoCreatedLeafQueue);
return autoCreatedLeafQueue; return autoCreatedLeafQueue;
} else { } else {
return autoQueueHandler.autoCreateQueue(placementContext); try {
writeLock.lock();
return autoQueueHandler.autoCreateQueue(placementContext);
} finally {
writeLock.unlock();
}
} }
} }

View File

@ -31,14 +31,11 @@
*/ */
public class CapacitySchedulerAutoQueueHandler { public class CapacitySchedulerAutoQueueHandler {
private final CapacitySchedulerQueueManager queueManager; private final CapacitySchedulerQueueManager queueManager;
private final CapacitySchedulerConfiguration conf;
private static final int MAXIMUM_DEPTH_ALLOWED = 2; private static final int MAXIMUM_DEPTH_ALLOWED = 2;
public CapacitySchedulerAutoQueueHandler( public CapacitySchedulerAutoQueueHandler(
CapacitySchedulerQueueManager queueManager, CapacitySchedulerQueueManager queueManager) {
CapacitySchedulerConfiguration conf) {
this.queueManager = queueManager; this.queueManager = queueManager;
this.conf = conf;
} }
/** /**

View File

@ -83,7 +83,7 @@ protected RMNodeLabelsManager createNodeLabelManager() {
mockRM.start(); mockRM.start();
cs.start(); cs.start();
autoQueueHandler = new CapacitySchedulerAutoQueueHandler( autoQueueHandler = new CapacitySchedulerAutoQueueHandler(
cs.getCapacitySchedulerQueueManager(), csConf); cs.getCapacitySchedulerQueueManager());
mockRM.registerNode("h1:1234", MAX_MEMORY * GB); // label = x mockRM.registerNode("h1:1234", MAX_MEMORY * GB); // label = x
} }
@ -409,7 +409,6 @@ public void testConvertDynamicParentToStaticParent() throws Exception {
@Test @Test
public void testAutoQueueCreationOnAppSubmission() throws Exception { public void testAutoQueueCreationOnAppSubmission() throws Exception {
startScheduler(); startScheduler();
createBasicQueueStructureAndValidate();
submitApp(cs, USER0, USER0, "root.e-auto"); submitApp(cs, USER0, USER0, "root.e-auto");