This is an automated email from the ASF dual-hosted git repository.
feiwang pushed a commit to branch branch-1.9
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/branch-1.9 by this push:
new 1b2d8c38d [KYUUBI #6680] Format the kyuubi-ctl batch command output
1b2d8c38d is described below
commit 1b2d8c38da2c58c09f9ec18de28d0bc746031cd6
Author: Wang, Fei <[email protected]>
AuthorDate: Sat Sep 14 12:54:44 2024 -0700
[KYUUBI #6680] Format the kyuubi-ctl batch command output
# :mag: 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 :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 ๐งช
#### Behavior Without This Pull Request :coffin:
#### Behavior With This Pull Request :tada:
#### 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
f9de99b92 [Wang, Fei] ut
0562d2d23 [Wang, Fei] unused
d44947894 [Wang, Fei] pretty
Authored-by: Wang, Fei <[email protected]>
Signed-off-by: Wang, Fei <[email protected]>
(cherry picked from commit 8e2b1b3e845718166830e0c84c2a1fd33210a583)
Signed-off-by: Wang, Fei <[email protected]>
---
.../scala/org/apache/kyuubi/ctl/cmd/delete/DeleteBatchCommand.scala | 2 +-
.../scala/org/apache/kyuubi/ctl/cmd/submit/SubmitBatchCommand.scala | 5 +++--
.../scala/org/apache/kyuubi/server/rest/client/BatchCliSuite.scala | 4 ++--
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git
a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/delete/DeleteBatchCommand.scala
b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/delete/DeleteBatchCommand.scala
index ee4a14d26..288c33ac9 100644
---
a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/delete/DeleteBatchCommand.scala
+++
b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/delete/DeleteBatchCommand.scala
@@ -38,7 +38,7 @@ class DeleteBatchCommand(cliConfig: CliConfig) extends
Command[Batch](cliConfig)
val result = batchRestApi.deleteBatch(batchId)
- info(JsonUtils.toJson(result))
+ info(JsonUtils.toPrettyJson(result))
if (!result.isSuccess) {
val batch = batchRestApi.getBatchById(batchId)
diff --git
a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/submit/SubmitBatchCommand.scala
b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/submit/SubmitBatchCommand.scala
index 863da98d4..926cf632e 100644
---
a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/submit/SubmitBatchCommand.scala
+++
b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/submit/SubmitBatchCommand.scala
@@ -17,7 +17,7 @@
package org.apache.kyuubi.ctl.cmd.submit
import org.apache.kyuubi.client.api.v1.dto.Batch
-import org.apache.kyuubi.client.util.{BatchUtils, JsonUtils}
+import org.apache.kyuubi.client.util.BatchUtils
import org.apache.kyuubi.ctl.ControlCliException
import org.apache.kyuubi.ctl.cmd.Command
import org.apache.kyuubi.ctl.cmd.create.CreateBatchCommand
@@ -48,7 +48,8 @@ class SubmitBatchCommand(cliConfig: CliConfig) extends
Command[Batch](cliConfig)
batch = logBatchCommand.doRun()
if (BatchUtils.isTerminalState(batch.getState) &&
!BatchUtils.isFinishedState(batch.getState)) {
- error(s"Batch ${batch.getId} failed: ${JsonUtils.toJson(batch)}")
+ error(s"Batch ${batch.getId} failed:")
+ error(Render.renderBatchInfo(batch))
throw ControlCliException(1)
}
diff --git
a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/rest/client/BatchCliSuite.scala
b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/rest/client/BatchCliSuite.scala
index 29caf0468..75253c8b9 100644
---
a/kyuubi-server/src/test/scala/org/apache/kyuubi/server/rest/client/BatchCliSuite.scala
+++
b/kyuubi-server/src/test/scala/org/apache/kyuubi/server/rest/client/BatchCliSuite.scala
@@ -171,7 +171,7 @@ class BatchCliSuite extends RestClientTestHelper with
TestPrematureExit with Bat
ldapUser,
"--password",
ldapUserPasswd)
- result = testPrematureExitForControlCli(deleteArgs, "\"success\":true")
+ result = testPrematureExitForControlCli(deleteArgs, "\"success\" : true")
eventually(timeout(3.seconds), interval(200.milliseconds)) {
assert(MetricsSystem.counterValue(
@@ -230,7 +230,7 @@ class BatchCliSuite extends RestClientTestHelper with
TestPrematureExit with Bat
batchId,
"--authSchema",
"spnego")
- result = testPrematureExitForControlCli(deleteArgs, "\"success\":true")
+ result = testPrematureExitForControlCli(deleteArgs, "\"success\" : true")
}
test("log batch test") {