You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/06/16 03:12:20 UTC
[GitHub] [incubator-kyuubi] turboFei opened a new pull request, #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch command
turboFei opened a new pull request, #2892:
URL: https://github.com/apache/incubator-kyuubi/pull/2892
<!--
Thanks for sending a pull request!
Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html
2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
-->
### _Why are the changes needed?_
<!--
Please clarify why the changes are needed. For instance,
1. If you add a feature, you can talk about the use case of it.
2. If you fix a bug, you can clarify why it is a bug.
-->
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [incubator-kyuubi] lightning-L commented on pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch commands for SubmitBatchCommand
Posted by GitBox <gi...@apache.org>.
lightning-L commented on PR #2892:
URL: https://github.com/apache/incubator-kyuubi/pull/2892#issuecomment-1157489568
I agree that we need to reuse the code in CreateBatchCommand and LogBatchCommand for submit batch operation.
But I am wondering if it is necessary to add a BatchCommand.
I think the main point is that we need to separate the calling api(do Run) part and the render part. Currently, those are stuck together in run() method.
For all the Command, the operation is: validate, doRun, and render.
We could separate the current run() method into doRun and render.
We could let doRun return object, and let render print the object.
It will apply to all kinds of resources. So we could do it in Command.scala instead of adding a new BatchCommand.scala?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [incubator-kyuubi] turboFei commented on a diff in pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch commands for SubmitBatchCommand
Posted by GitBox <gi...@apache.org>.
turboFei commented on code in PR #2892:
URL: https://github.com/apache/incubator-kyuubi/pull/2892#discussion_r898705557
##########
kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/BatchCommand.scala:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kyuubi.ctl.cmd
+
+import org.apache.kyuubi.client.api.v1.dto.Batch
+import org.apache.kyuubi.ctl.CliConfig
+import org.apache.kyuubi.ctl.util.Render
+
+abstract class BatchCommand(cliConfig: CliConfig) extends Command(cliConfig) {
+
+ def doRunAndReturnBatchReport(): Batch
+
+ override def run(): Unit = {
Review Comment:
ok
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [incubator-kyuubi] turboFei commented on pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch commands for SubmitBatchCommand
Posted by GitBox <gi...@apache.org>.
turboFei commented on PR #2892:
URL: https://github.com/apache/incubator-kyuubi/pull/2892#issuecomment-1157502474
> I agree that we need to reuse the code in CreateBatchCommand and LogBatchCommand for submit batch operation. But I am wondering if it is necessary to add a BatchCommand.
>
> I think the main point is that we need to separate the calling api(do Run) part and the render part. Currently, those are stuck together in run() method.
>
> For all the Command, the operation is: validate, doRun, and render. We could separate the current run() method into doRun and render. We could let doRun return object, and let render print the object. It will apply to all kinds of resources. So we could do it in Command.scala instead of adding a new BatchCommand.scala?
thanks @lightning-L
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [incubator-kyuubi] turboFei commented on pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch commands for SubmitBatchCommand
Posted by GitBox <gi...@apache.org>.
turboFei commented on PR #2892:
URL: https://github.com/apache/incubator-kyuubi/pull/2892#issuecomment-1157547449
thanks @lightning-L
could you have a review again?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [incubator-kyuubi] turboFei commented on a diff in pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch command
Posted by GitBox <gi...@apache.org>.
turboFei commented on code in PR #2892:
URL: https://github.com/apache/incubator-kyuubi/pull/2892#discussion_r898669104
##########
kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/BatchCommand.scala:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kyuubi.ctl.cmd
+
+import org.apache.kyuubi.client.api.v1.dto.Batch
+import org.apache.kyuubi.ctl.CliConfig
+import org.apache.kyuubi.ctl.util.Render
+
+abstract class BatchCommand(cliConfig: CliConfig) extends Command(cliConfig) {
+
+ override def run(): Unit = {
+ doRunAndReturnBatchReport.foreach { batch =>
+ info(Render.renderBatchInfo(batch))
+ }
+ }
+
+ def doRunAndReturnBatchReport(): Option[Batch]
Review Comment:
cc @ulysses-you
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [incubator-kyuubi] lightning-L commented on pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch commands for SubmitBatchCommand
Posted by GitBox <gi...@apache.org>.
lightning-L commented on PR #2892:
URL: https://github.com/apache/incubator-kyuubi/pull/2892#issuecomment-1157567167
> thanks @lightning-L could you have a review again?
I am okay with current implementation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [incubator-kyuubi] turboFei commented on pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch command
Posted by GitBox <gi...@apache.org>.
turboFei commented on PR #2892:
URL: https://github.com/apache/incubator-kyuubi/pull/2892#issuecomment-1157204400
cc @lightning-L
Hope it can simplify the following optimization for SubmitBatchCommand and LogBatchCommand.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [incubator-kyuubi] turboFei closed pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch commands for SubmitBatchCommand
Posted by GitBox <gi...@apache.org>.
turboFei closed pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch commands for SubmitBatchCommand
URL: https://github.com/apache/incubator-kyuubi/pull/2892
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [incubator-kyuubi] codecov-commenter commented on pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch commands for SubmitBatchCommand
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #2892:
URL: https://github.com/apache/incubator-kyuubi/pull/2892#issuecomment-1157297358
# [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#2892](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (37e0efd) into [master](https://codecov.io/gh/apache/incubator-kyuubi/commit/27330ddb8e93dfeb5fc7ede619afe3e2e135b701?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (27330dd) will **increase** coverage by `0.29%`.
> The diff coverage is `81.57%`.
```diff
@@ Coverage Diff @@
## master #2892 +/- ##
============================================
+ Coverage 63.79% 64.08% +0.29%
- Complexity 205 215 +10
============================================
Files 508 518 +10
Lines 22258 22871 +613
Branches 2942 3004 +62
============================================
+ Hits 14200 14658 +458
- Misses 6724 6822 +98
- Partials 1334 1391 +57
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...cala/org/apache/kyuubi/ctl/RestClientFactory.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWN0bC9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jdGwvUmVzdENsaWVudEZhY3Rvcnkuc2NhbGE=) | `90.00% <ø> (ø)` | |
| [...che/kyuubi/ctl/cmd/delete/DeleteBatchCommand.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWN0bC9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jdGwvY21kL2RlbGV0ZS9EZWxldGVCYXRjaENvbW1hbmQuc2NhbGE=) | `57.14% <50.00%> (+3.29%)` | :arrow_up: |
| [...che/kyuubi/ctl/cmd/submit/SubmitBatchCommand.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWN0bC9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jdGwvY21kL3N1Ym1pdC9TdWJtaXRCYXRjaENvbW1hbmQuc2NhbGE=) | `80.00% <76.92%> (-11.18%)` | :arrow_down: |
| [...rg/apache/kyuubi/ctl/cmd/log/LogBatchCommand.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWN0bC9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jdGwvY21kL2xvZy9Mb2dCYXRjaENvbW1hbmQuc2NhbGE=) | `89.65% <85.71%> (-3.21%)` | :arrow_down: |
| [...scala/org/apache/kyuubi/ctl/cmd/BatchCommand.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWN0bC9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jdGwvY21kL0JhdGNoQ29tbWFuZC5zY2FsYQ==) | `100.00% <100.00%> (ø)` | |
| [...che/kyuubi/ctl/cmd/create/CreateBatchCommand.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWN0bC9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jdGwvY21kL2NyZWF0ZS9DcmVhdGVCYXRjaENvbW1hbmQuc2NhbGE=) | `100.00% <100.00%> (ø)` | |
| [...rg/apache/kyuubi/ctl/cmd/get/GetBatchCommand.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWN0bC9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jdGwvY21kL2dldC9HZXRCYXRjaENvbW1hbmQuc2NhbGE=) | `83.33% <100.00%> (-2.39%)` | :arrow_down: |
| [...apache/kyuubi/session/KyuubiBatchSessionImpl.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXNzaW9uL0t5dXViaUJhdGNoU2Vzc2lvbkltcGwuc2NhbGE=) | `90.90% <0.00%> (-5.65%)` | :arrow_down: |
| [...e/authentication/KyuubiAuthenticationFactory.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWNvbW1vbi9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2aWNlL2F1dGhlbnRpY2F0aW9uL0t5dXViaUF1dGhlbnRpY2F0aW9uRmFjdG9yeS5zY2FsYQ==) | `79.41% <0.00%> (-3.35%)` | :arrow_down: |
| [...apache/kyuubi/service/TBinaryFrontendService.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWNvbW1vbi9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2aWNlL1RCaW5hcnlGcm9udGVuZFNlcnZpY2Uuc2NhbGE=) | `87.75% <0.00%> (-1.61%)` | :arrow_down: |
| ... and [32 more](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [27330dd...37e0efd](https://codecov.io/gh/apache/incubator-kyuubi/pull/2892?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [incubator-kyuubi] turboFei commented on pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch commands for SubmitBatchCommand
Posted by GitBox <gi...@apache.org>.
turboFei commented on PR #2892:
URL: https://github.com/apache/incubator-kyuubi/pull/2892#issuecomment-1157721686
thanks, merging to master
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [incubator-kyuubi] ulysses-you commented on a diff in pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch commands for SubmitBatchCommand
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on code in PR #2892:
URL: https://github.com/apache/incubator-kyuubi/pull/2892#discussion_r898704961
##########
kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/BatchCommand.scala:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kyuubi.ctl.cmd
+
+import org.apache.kyuubi.client.api.v1.dto.Batch
+import org.apache.kyuubi.ctl.CliConfig
+import org.apache.kyuubi.ctl.util.Render
+
+abstract class BatchCommand(cliConfig: CliConfig) extends Command(cliConfig) {
+
+ def doRunAndReturnBatchReport(): Batch
+
+ override def run(): Unit = {
Review Comment:
shall we make it `final` ? otherwise it just add complexity ..
##########
kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/delete/DeleteBatchCommand.scala:
##########
@@ -35,16 +36,22 @@ class DeleteBatchCommand(cliConfig: CliConfig) extends Command(cliConfig) {
info(JsonUtil.toJson(result))
- if (!result.isSuccess) {
- val batch = batchRestApi.getBatchById(batchId)
- if (!BatchUtil.isTerminalState(batch.getState)) {
- error(s"Failed to delete batch $batchId, its current state is ${batch.getState}")
- throw ControlCliException(1)
- } else {
- warn(s"Batch $batchId is already in terminal state ${batch.getState}.")
- }
+ if (result.isSuccess) {
+ null
+ } else {
+ batchRestApi.getBatchById(batchId)
}
}
}
+ override def run(): Unit = {
Review Comment:
can not we do this inside `doRunAndReturnBatchReport ` ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [incubator-kyuubi] turboFei commented on a diff in pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch command
Posted by GitBox <gi...@apache.org>.
turboFei commented on code in PR #2892:
URL: https://github.com/apache/incubator-kyuubi/pull/2892#discussion_r898669014
##########
kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/BatchCommand.scala:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kyuubi.ctl.cmd
+
+import org.apache.kyuubi.client.api.v1.dto.Batch
+import org.apache.kyuubi.ctl.CliConfig
+import org.apache.kyuubi.ctl.util.Render
+
+abstract class BatchCommand(cliConfig: CliConfig) extends Command(cliConfig) {
+
+ override def run(): Unit = {
+ doRunAndReturnBatchReport.foreach { batch =>
+ info(Render.renderBatchInfo(batch))
+ }
+ }
+
+ def doRunAndReturnBatchReport(): Option[Batch]
Review Comment:
now ListBatchesCommand does not extend `BatchCommand`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [incubator-kyuubi] turboFei commented on a diff in pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch command
Posted by GitBox <gi...@apache.org>.
turboFei commented on code in PR #2892:
URL: https://github.com/apache/incubator-kyuubi/pull/2892#discussion_r898669452
##########
kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/BatchCommand.scala:
##########
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kyuubi.ctl.cmd
+
+import org.apache.kyuubi.client.api.v1.dto.Batch
+import org.apache.kyuubi.ctl.CliConfig
+import org.apache.kyuubi.ctl.util.Render
+
+abstract class BatchCommand(cliConfig: CliConfig) extends Command(cliConfig) {
+
+ override def run(): Unit = {
+ doRunAndReturnBatchReport.foreach { batch =>
+ info(Render.renderBatchInfo(batch))
+ }
+ }
+
+ def doRunAndReturnBatchReport(): Option[Batch]
Review Comment:
ListBatchesCommand should be `BatchesCommand`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
[GitHub] [incubator-kyuubi] ulysses-you commented on a diff in pull request #2892: [KYUUBI #2628][FOLLOWUP] Reuse the kyuubi-ctl batch commands for SubmitBatchCommand
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on code in PR #2892:
URL: https://github.com/apache/incubator-kyuubi/pull/2892#discussion_r899009784
##########
kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/Command.scala:
##########
@@ -45,7 +45,15 @@ abstract class Command(cliConfig: CliConfig) extends Logging {
/** Ensure that required fields exists. Call this only once all defaults are loaded. */
def validate(): Unit
- def run(): Unit
+ /** Run the command and return the internal result. */
+ def doRun(): Any
+
+ /** Render the internal result. */
+ def render(obj: Any): Unit
Review Comment:
Command[T]
def doRun(): T
def render(obj: T): Unit
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org