This is an automated email from the ASF dual-hosted git repository. sunilg pushed a commit to branch branch-3.2 in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.2 by this push: new fbc0814 YARN-9257. Distributed Shell client throws a NPE for a non-existent queue. Contributed by Charan Hebri. fbc0814 is described below commit fbc08145cfb6a81395448c4b3463bf6d28a6272b Author: Sunil G <sun...@apache.org> AuthorDate: Fri Feb 8 11:22: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 | 16 ++++++++++++++++ 2 files changed, 22 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 e8b69fe..ecbe288 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 @@ -651,6 +651,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 49d8f3d..b41fea6 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 @@ -1630,4 +1630,20 @@ public class TestDistributedShell { client.init(args); 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(); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org