Skip to content

Commit fff1d2c

Browse files
committed
YARN-10260. Allow transitioning queue from DRAINING to RUNNING state. Contributed by Bilwa S T
1 parent 936bf09 commit fff1d2c

File tree

2 files changed

+17
-4
lines changed
  • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src

2 files changed

+17
-4
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/AbstractCSQueue.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,10 +1359,6 @@ public void activeQueue() throws YarnException {
13591359
if (getState() == QueueState.RUNNING) {
13601360
LOG.info("The specified queue:" + getQueuePath()
13611361
+ " is already in the RUNNING state.");
1362-
} else if (getState() == QueueState.DRAINING) {
1363-
throw new YarnException(
1364-
"The queue:" + getQueuePath() + " is in the Stopping process. "
1365-
+ "Please wait for the queue getting fully STOPPED.");
13661362
} else {
13671363
CSQueue parent = getParent();
13681364
if (parent == null || parent.getState() == QueueState.RUNNING) {

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestQueueState.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,23 @@ public void testQueueStateTransit() throws Exception {
157157
Assert.assertEquals(QueueState.DRAINING, cs.getQueue(Q2).getState());
158158
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q3).getState());
159159

160+
// set Q2 state to RUNNING and do reinitialize.
161+
// Q2 should transit from DRAINING to RUNNING
162+
csConf.setState(Q2_PATH, QueueState.RUNNING);
163+
conf = new YarnConfiguration(csConf);
164+
cs.reinitialize(conf, rmContext);
165+
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q1).getState());
166+
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q2).getState());
167+
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q3).getState());
168+
169+
// set Q2 state to stop and do reinitialize.
170+
csConf.setState(Q2_PATH, QueueState.STOPPED);
171+
conf = new YarnConfiguration(csConf);
172+
cs.reinitialize(conf, rmContext);
173+
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q1).getState());
174+
Assert.assertEquals(QueueState.DRAINING, cs.getQueue(Q2).getState());
175+
Assert.assertEquals(QueueState.RUNNING, cs.getQueue(Q3).getState());
176+
160177
// set Q1 state to stop and do reinitialize.
161178
csConf.setState(Q1_PATH, QueueState.STOPPED);
162179
conf = new YarnConfiguration(csConf);

0 commit comments

Comments
 (0)