From f149af7f2b5e9bcaf3355147fb95a110b66afbb4 Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Wed, 8 May 2024 11:41:25 +0800 Subject: [PATCH] [KYUUBI #6366] Improve log message for YARN getApplicationInfoByTag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # :mag: Description Unify the words and provide the tag for the waiting submission case. ## Types of changes :bookmark: - [ ] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan ๐Ÿงช Manually review. --- # Checklist ๐Ÿ“ - [x] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) **Be nice. Be informative.** Closes #6366 from pan3793/improve-log. Closes #6366 30e3fdee0 [Cheng Pan] fix style a3b36ea33 [Cheng Pan] Improve log message for YARN getApplicationInfoByTag Authored-by: Cheng Pan Signed-off-by: Cheng Pan (cherry picked from commit d19119bae1683ad43c7c749dfc9592b711471db2) Signed-off-by: Cheng Pan --- .../engine/YarnApplicationOperation.scala | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/YarnApplicationOperation.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/YarnApplicationOperation.scala index 18d0006a5..9d6ca32fa 100644 --- a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/YarnApplicationOperation.scala +++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/YarnApplicationOperation.scala @@ -27,7 +27,7 @@ import org.apache.hadoop.yarn.client.api.YarnClient import org.apache.kyuubi.{Logging, Utils} import org.apache.kyuubi.config.KyuubiConf -import org.apache.kyuubi.config.KyuubiConf.YarnUserStrategy +import org.apache.kyuubi.config.KyuubiConf.{ENGINE_YARN_SUBMIT_TIMEOUT, YarnUserStrategy} import org.apache.kyuubi.config.KyuubiConf.YarnUserStrategy._ import org.apache.kyuubi.engine.ApplicationOperation._ import org.apache.kyuubi.engine.ApplicationState.ApplicationState @@ -129,21 +129,22 @@ class YarnApplicationOperation extends ApplicationOperation with Logging { tag: String, proxyUser: Option[String] = None, submitTime: Option[Long] = None): ApplicationInfo = withYarnClient(proxyUser) { yarnClient => - debug(s"Getting application info from Yarn cluster by $tag tag") + debug(s"Getting application info from YARN cluster by tag: $tag") val reports = yarnClient.getApplications(null, null, Set(tag).asJava) if (reports.isEmpty) { - debug(s"Application with tag $tag not found") + debug(s"Can't find target application from YARN cluster by tag: $tag") submitTime match { case Some(_submitTime) => val elapsedTime = System.currentTimeMillis - _submitTime - if (elapsedTime > submitTimeout) { - error(s"Can't find target yarn application by tag: $tag, " + - s"elapsed time: ${elapsedTime}ms exceeds ${submitTimeout}ms.") - ApplicationInfo.NOT_FOUND - } else { - warn("Wait for yarn application to be submitted, " + - s"elapsed time: ${elapsedTime}ms, return UNKNOWN status") + if (elapsedTime < submitTimeout) { + info(s"Wait for YARN application[tag: $tag] to be submitted, " + + s"elapsed time: ${elapsedTime}ms, return ${ApplicationInfo.UNKNOWN} status") ApplicationInfo.UNKNOWN + } else { + error(s"Can't find target application from YARN cluster by tag: $tag, " + + s"elapsed time: ${elapsedTime}ms exceeds ${ENGINE_YARN_SUBMIT_TIMEOUT.key}: " + + s"${submitTimeout}ms, return ${ApplicationInfo.NOT_FOUND} status") + ApplicationInfo.NOT_FOUND } case _ => ApplicationInfo.NOT_FOUND } @@ -158,7 +159,7 @@ class YarnApplicationOperation extends ApplicationOperation with Logging { report.getFinalApplicationStatus), url = Option(report.getTrackingUrl), error = Option(report.getDiagnostics)) - debug(s"Successfully got application info by $tag: $info") + debug(s"Successfully got application info by tag: $tag. $info") info } }