Skip to content

Commit

Permalink
[KYUUBI #6680] Format the kyuubi-ctl batch command output
Browse files Browse the repository at this point in the history
# 🔍 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]>
  • Loading branch information
turboFei committed Sep 14, 2024
1 parent f8431da commit 8e2b1b3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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") {
Expand Down

0 comments on commit 8e2b1b3

Please sign in to comment.