YARN-10260. Allow transitioning queue from DRAINING to RUNNING state. Contributed by Bilwa S T

(cherry picked from commit fff1d2c122)
(cherry picked from commit 564d3211f2)
This commit is contained in:
Jonathan Hung 2020-05-12 10:48:54 -07:00
parent b706ac11f7
commit a7ea55e015
2 changed files with 17 additions and 4 deletions

View File

@ -1295,10 +1295,6 @@ public abstract class AbstractCSQueue implements CSQueue {
if (getState() == QueueState.RUNNING) { if (getState() == QueueState.RUNNING) {
LOG.info("The specified queue:" + queueName LOG.info("The specified queue:" + queueName
+ " is already in the RUNNING state."); + " is already in the RUNNING state.");
} else if (getState() == QueueState.DRAINING) {
throw new YarnException(
"The queue:" + queueName + " is in the Stopping process. "
+ "Please wait for the queue getting fully STOPPED.");
} else { } else {
CSQueue parent = getParent(); CSQueue parent = getParent();
if (parent == null || parent.getState() == QueueState.RUNNING) { if (parent == null || parent.getState() == QueueState.RUNNING) {

View File

@ -156,6 +156,23 @@ public class TestQueueState {
Assert.assertEquals(QueueState.DRAINING, cs.getQueue(Q2).getState()); Assert.assertEquals(QueueState.DRAINING, cs.getQueue(Q2).getState());
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q3).getState()); Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q3).getState());
// set Q2 state to RUNNING and do reinitialize.
// Q2 should transit from DRAINING to RUNNING
csConf.setState(Q2_PATH, QueueState.RUNNING);
conf = new YarnConfiguration(csConf);
cs.reinitialize(conf, rmContext);
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q1).getState());
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q2).getState());
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q3).getState());
// set Q2 state to stop and do reinitialize.
csConf.setState(Q2_PATH, QueueState.STOPPED);
conf = new YarnConfiguration(csConf);
cs.reinitialize(conf, rmContext);
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q1).getState());
Assert.assertEquals(QueueState.DRAINING, cs.getQueue(Q2).getState());
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q3).getState());
// set Q1 state to stop and do reinitialize. // set Q1 state to stop and do reinitialize.
csConf.setState(Q1_PATH, QueueState.STOPPED); csConf.setState(Q1_PATH, QueueState.STOPPED);
conf = new YarnConfiguration(csConf); conf = new YarnConfiguration(csConf);