This is an automated email from the ASF dual-hosted git repository.
sunilg pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new ba38db4 YARN-9257. Distributed Shell client throws a NPE for a
non-existent queue. Contributed by Charan Hebri.
ba38db4 is described below
commit ba38db4f5b7d8a1432a9a1b4adaa5c1545218799
Author: Sunil G <[email protected]>
AuthorDate: Tue Feb 5 13:41:44 2019 +0530
YARN-9257. Distributed Shell client throws a NPE for a non-existent queue.
Contributed by Charan Hebri.
---
.../yarn/applications/distributedshell/Client.java | 6 ++++++
.../distributedshell/TestDistributedShell.java | 18 ++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java
index 1666325..257f590 100644
---
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java
+++
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/Client.java
@@ -676,6 +676,12 @@ public class Client {
}
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"
+ ", queueName=" + queueInfo.getQueueName()
+ ", queueCurrentCapacity=" + queueInfo.getCurrentCapacity()
diff --git
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java
index e67e541..1c606ab 100644
---
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java
+++
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/test/java/org/apache/hadoop/yarn/applications/distributedshell/TestDistributedShell.java
@@ -1728,6 +1728,24 @@ public class TestDistributedShell {
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();
+ }
+
@Test
public void testDistributedShellWithSingleFileLocalization()
throws Exception {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]