From 598483e496a0e0253310817d8d1bd3511318bc8b Mon Sep 17 00:00:00 2001 From: Billie Rinaldi Date: Thu, 26 Apr 2018 12:52:22 -0700 Subject: [PATCH] YARN-8140. Improve log message when launch cmd is ran for stopped yarn service. Contributed by Eric Yang --- .../org/apache/hadoop/yarn/service/webapp/ApiServer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/service/webapp/ApiServer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/service/webapp/ApiServer.java index 6f32598f81..9a30fcfb13 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/service/webapp/ApiServer.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/service/webapp/ApiServer.java @@ -167,8 +167,13 @@ public ApplicationId run() throws IOException, YarnException { String message = "Failed to create service " + service.getName() + ": {}"; LOG.error(message, e); + if (e.getCause().getMessage().contains("already exists")) { + message = "Service name " + service.getName() + " is already taken."; + } else { + message = e.getCause().getMessage(); + } return formatResponse(Status.INTERNAL_SERVER_ERROR, - e.getCause().getMessage()); + message); } }