Skip to content

Commit

Permalink
[KYUUBI #6366] Improve log message for YARN getApplicationInfoByTag
Browse files Browse the repository at this point in the history
# 🔍 Description

Unify the words and provide the tag for the waiting submission case.

## Types of changes 🔖

- [ ] 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

30e3fde [Cheng Pan] fix style
a3b36ea [Cheng Pan] Improve log message for YARN getApplicationInfoByTag

Authored-by: Cheng Pan <chengpan@apache.org>
Signed-off-by: Cheng Pan <chengpan@apache.org>
  • Loading branch information
pan3793 committed May 8, 2024
1 parent 4f76373 commit d19119b
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
}
Expand Down

0 comments on commit d19119b

Please sign in to comment.