[KYUUBI #6579] Show kyuubi batch app details on app state change
# 🔍 Description ## Issue References 🔗 This pr enhance the kyuubi batch logs for spark on k8s with kyuubi-ctl. ## Describe Your Solution 🔧 For spark on k8s, before, it does not show the app detail info until the log batch command finished. In this PR, it will show the batch app details in app state change. Especially show the app URL info. ## Types of changes 🔖 - [ ] Bugfix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan 🧪 #### Behavior Without This Pull Request ⚰️ #### Behavior With This Pull Request 🎉 #### Related Unit Tests <img width="1326" alt="image" src="https://github.com/user-attachments/assets/2356af83-4422-4dfc-812c-d90b809ea724"> --- # 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 #6579 from turboFei/print_batch_report. Closes #6579 0651dad18 [Wang, Fei] show app details on app state change Authored-by: Wang, Fei <fwang12@ebay.com> Signed-off-by: Wang, Fei <fwang12@ebay.com>
This commit is contained in:
parent
c94f0d7a54
commit
2a990beb71
@ -20,6 +20,8 @@ import java.util.{Map => JMap}
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
|
||||
import org.apache.kyuubi.client.BatchRestApi
|
||||
import org.apache.kyuubi.client.api.v1.dto.{Batch, OperationLog}
|
||||
import org.apache.kyuubi.client.util.BatchUtils
|
||||
@ -50,6 +52,7 @@ class LogBatchCommand(
|
||||
|
||||
var done = false
|
||||
var batch = this.batch.getOrElse(batchRestApi.getBatchById(batchId))
|
||||
var appState = this.batch.map(_.getAppState).orNull
|
||||
val kyuubiInstance = batch.getKyuubiInstance
|
||||
|
||||
withKyuubiInstanceRestClient(kyuubiRestClient, kyuubiInstance) { kyuubiInstanceRestClient =>
|
||||
@ -85,6 +88,11 @@ class LogBatchCommand(
|
||||
Option(batch).foreach { batch =>
|
||||
info(s"Application report for ${batch.getAppId} (state: ${batch.getAppState})," +
|
||||
s" batch id: $batchId (state: ${batch.getState})")
|
||||
if (appState != batch.getAppState && StringUtils.isNotBlank(batch.getAppId)) {
|
||||
appState = batch.getAppState
|
||||
val appDetails = Render.buildBatchAppInfo(batch).mkString("\t ", "\n\t ", "")
|
||||
info(appDetails)
|
||||
}
|
||||
}
|
||||
}
|
||||
Thread.sleep(conf.get(CTL_BATCH_LOG_QUERY_INTERVAL))
|
||||
|
||||
@ -122,7 +122,7 @@ private[ctl] object Render {
|
||||
millisToDateString(batch.getEndTime, "yyyy-MM-dd HH:mm:ss")).mkString("\n~\n"))
|
||||
}
|
||||
|
||||
private def buildBatchAppInfo(batch: Batch, showDiagnostic: Boolean = true): List[String] = {
|
||||
def buildBatchAppInfo(batch: Batch, showDiagnostic: Boolean = true): List[String] = {
|
||||
val batchAppInfo = ListBuffer[String]()
|
||||
batch.getBatchInfo.asScala.foreach { case (key, value) =>
|
||||
batchAppInfo += s"$key: $value"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user