YARN-9257. Distributed Shell client throws a NPE for a non-existent queue. Contributed by Charan Hebri.
(cherry picked from commit fbc08145cf
)
This commit is contained in:
parent
1f4be45ef6
commit
73956d5de9
|
@ -648,6 +648,12 @@ public class Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueInfo queueInfo = yarnClient.getQueueInfo(this.amQueue);
|
QueueInfo queueInfo = yarnClient.getQueueInfo(this.amQueue);
|
||||||
|
if (queueInfo == null) {
|
||||||
|
throw new IllegalArgumentException(String
|
||||||
|
.format("Queue %s not present in scheduler configuration.",
|
||||||
|
this.amQueue));
|
||||||
|
}
|
||||||
|
|
||||||
LOG.info("Queue info"
|
LOG.info("Queue info"
|
||||||
+ ", queueName=" + queueInfo.getQueueName()
|
+ ", queueName=" + queueInfo.getQueueName()
|
||||||
+ ", queueCurrentCapacity=" + queueInfo.getCurrentCapacity()
|
+ ", queueCurrentCapacity=" + queueInfo.getCurrentCapacity()
|
||||||
|
|
|
@ -1630,4 +1630,20 @@ public class TestDistributedShell {
|
||||||
client.init(args);
|
client.init(args);
|
||||||
client.run();
|
client.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expected = IllegalArgumentException.class)
|
||||||
|
public void testDistributedShellNonExistentQueue() throws Exception {
|
||||||
|
String[] args = {
|
||||||
|
"--jar",
|
||||||
|
APPMASTER_JAR,
|
||||||
|
"--num_containers",
|
||||||
|
"1",
|
||||||
|
"--shell_command",
|
||||||
|
Shell.WINDOWS ? "dir" : "ls",
|
||||||
|
"--queue",
|
||||||
|
"non-existent-queue" };
|
||||||
|
Client client = new Client(new Configuration(yarnCluster.getConfig()));
|
||||||
|
client.init(args);
|
||||||
|
client.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue