Skip to content

Commit 8e2b1b3

Browse files
committed
[KYUUBI #6680] Format the kyuubi-ctl batch command output
# 🔍 Description ## Issue References 🔗 As title, format the batch command output. ## Describe Your Solution 🔧 Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. ## 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 🧪 #### Behavior Without This Pull Request ⚰️ #### Behavior With This Pull Request 🎉 #### Related Unit Tests --- # 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 #6680 from turboFei/batch_error. Closes #6680 f9de99b [Wang, Fei] ut 0562d2d [Wang, Fei] unused d449478 [Wang, Fei] pretty Authored-by: Wang, Fei <[email protected]> Signed-off-by: Wang, Fei <[email protected]>
1 parent f8431da commit 8e2b1b3

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/delete/DeleteBatchCommand.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class DeleteBatchCommand(cliConfig: CliConfig) extends Command[Batch](cliConfig)
3838

3939
val result = batchRestApi.deleteBatch(batchId)
4040

41-
info(JsonUtils.toJson(result))
41+
info(JsonUtils.toPrettyJson(result))
4242

4343
if (!result.isSuccess) {
4444
val batch = batchRestApi.getBatchById(batchId)

kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/submit/SubmitBatchCommand.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.apache.kyuubi.ctl.cmd.submit
1818

1919
import org.apache.kyuubi.client.api.v1.dto.Batch
20-
import org.apache.kyuubi.client.util.{BatchUtils, JsonUtils}
20+
import org.apache.kyuubi.client.util.BatchUtils
2121
import org.apache.kyuubi.ctl.ControlCliException
2222
import org.apache.kyuubi.ctl.cmd.Command
2323
import org.apache.kyuubi.ctl.cmd.create.CreateBatchCommand
@@ -48,7 +48,8 @@ class SubmitBatchCommand(cliConfig: CliConfig) extends Command[Batch](cliConfig)
4848
batch = logBatchCommand.doRun()
4949

5050
if (BatchUtils.isTerminalState(batch.getState) && !BatchUtils.isFinishedState(batch.getState)) {
51-
error(s"Batch ${batch.getId} failed: ${JsonUtils.toJson(batch)}")
51+
error(s"Batch ${batch.getId} failed:")
52+
error(Render.renderBatchInfo(batch))
5253
throw ControlCliException(1)
5354
}
5455

kyuubi-server/src/test/scala/org/apache/kyuubi/server/rest/client/BatchCliSuite.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class BatchCliSuite extends RestClientTestHelper with TestPrematureExit with Bat
171171
ldapUser,
172172
"--password",
173173
ldapUserPasswd)
174-
result = testPrematureExitForControlCli(deleteArgs, "\"success\":true")
174+
result = testPrematureExitForControlCli(deleteArgs, "\"success\" : true")
175175

176176
eventually(timeout(3.seconds), interval(200.milliseconds)) {
177177
assert(MetricsSystem.counterValue(
@@ -230,7 +230,7 @@ class BatchCliSuite extends RestClientTestHelper with TestPrematureExit with Bat
230230
batchId,
231231
"--authSchema",
232232
"spnego")
233-
result = testPrematureExitForControlCli(deleteArgs, "\"success\":true")
233+
result = testPrematureExitForControlCli(deleteArgs, "\"success\" : true")
234234
}
235235

236236
test("log batch test") {

0 commit comments

Comments
 (0)