You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "yuruguo (via GitHub)" <gi...@apache.org> on 2023/06/07 12:54:10 UTC

[GitHub] [pulsar] yuruguo opened a new pull request, #20530: [fix][admin] Make admin.cli throw exception instead of silent catch

yuruguo opened a new pull request, #20530:
URL: https://github.com/apache/pulsar/pull/20530

   ### Motivation
   Follows #20503 
   
   ### Modifications
   - CmdClusters
   - CmdFunctions
   - CmdSinks
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Does this pull request potentially affect one of the following parts:
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [ ] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [ ] The metrics
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] michaeljmarshall commented on a diff in pull request #20530: [fix][admin] Make admin.cli throw exception instead of silent catch

Posted by "michaeljmarshall (via GitHub)" <gi...@apache.org>.
michaeljmarshall commented on code in PR #20530:
URL: https://github.com/apache/pulsar/pull/20530#discussion_r1223418499


##########
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdClusters.java:
##########
@@ -268,11 +268,9 @@ void run() throws Exception {
             try {
                 processArguments();
             } catch (Exception e) {
-                System.err.println(e.getMessage());
-                System.err.println();
                 String chosenCommand = jcommander.getParsedCommand();
                 getUsageFormatter().usage(chosenCommand);
-                return;
+                throw e;

Review Comment:
   nice, thanks for sharing!



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] codecov-commenter commented on pull request #20530: [fix][admin] Make admin.cli throw exception instead of silent catch

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #20530:
URL: https://github.com/apache/pulsar/pull/20530#issuecomment-1580995093

   ## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/20530?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   > Merging [#20530](https://app.codecov.io/gh/apache/pulsar/pull/20530?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (ebf9de6) into [master](https://app.codecov.io/gh/apache/pulsar/commit/d7f355881b2b1eebf2be6ea262c202660d684fb7?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (d7f3558) will **increase** coverage by `36.11%`.
   > The diff coverage is `38.88%`.
   
   [![Impacted file tree graph](https://app.codecov.io/gh/apache/pulsar/pull/20530/graphs/tree.svg?width=650&height=150&src=pr&token=acYqCpsK9J&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/pulsar/pull/20530?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@              Coverage Diff              @@
   ##             master   #20530       +/-   ##
   =============================================
   + Coverage     36.82%   72.94%   +36.11%     
   - Complexity    12040    31918    +19878     
   =============================================
     Files          1690     1867      +177     
     Lines        128968   138549     +9581     
     Branches      14036    15218     +1182     
   =============================================
   + Hits          47493   101061    +53568     
   + Misses        75220    29469    -45751     
   - Partials       6255     8019     +1764     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | inttests | `24.17% <0.00%> (+0.02%)` | :arrow_up: |
   | systests | `24.92% <0.00%> (-0.14%)` | :arrow_down: |
   | unittests | `72.23% <38.88%> (+40.33%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://app.codecov.io/gh/apache/pulsar/pull/20530?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [.../java/org/apache/pulsar/admin/cli/CmdClusters.java](https://app.codecov.io/gh/apache/pulsar/pull/20530?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC10b29scy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2FkbWluL2NsaS9DbWRDbHVzdGVycy5qYXZh) | `73.07% <0.00%> (+73.07%)` | :arrow_up: |
   | [...ain/java/org/apache/pulsar/admin/cli/CmdSinks.java](https://app.codecov.io/gh/apache/pulsar/pull/20530?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC10b29scy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2FkbWluL2NsaS9DbWRTaW5rcy5qYXZh) | `43.46% <0.00%> (+43.46%)` | :arrow_up: |
   | [.../pulsar/functions/runtime/JavaInstanceStarter.java](https://app.codecov.io/gh/apache/pulsar/pull/20530?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWZ1bmN0aW9ucy9ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9wdWxzYXIvZnVuY3Rpb25zL3J1bnRpbWUvSmF2YUluc3RhbmNlU3RhcnRlci5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...he/pulsar/broker/admin/v2/NonPersistentTopics.java](https://app.codecov.io/gh/apache/pulsar/pull/20530?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi92Mi9Ob25QZXJzaXN0ZW50VG9waWNzLmphdmE=) | `61.92% <33.33%> (+34.14%)` | :arrow_up: |
   | [...pache/pulsar/broker/admin/v2/PersistentTopics.java](https://app.codecov.io/gh/apache/pulsar/pull/20530?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi92Mi9QZXJzaXN0ZW50VG9waWNzLmphdmE=) | `80.83% <33.33%> (+67.96%)` | :arrow_up: |
   | [...unctions/runtime/kubernetes/KubernetesRuntime.java](https://app.codecov.io/gh/apache/pulsar/pull/20530?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWZ1bmN0aW9ucy9ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9wdWxzYXIvZnVuY3Rpb25zL3J1bnRpbWUva3ViZXJuZXRlcy9LdWJlcm5ldGVzUnVudGltZS5qYXZh) | `38.73% <50.00%> (+38.73%)` | :arrow_up: |
   | [...java/org/apache/pulsar/admin/cli/CmdFunctions.java](https://app.codecov.io/gh/apache/pulsar/pull/20530?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC10b29scy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2FkbWluL2NsaS9DbWRGdW5jdGlvbnMuamF2YQ==) | `46.20% <100.00%> (+46.20%)` | :arrow_up: |
   | [...n/java/org/apache/pulsar/admin/cli/CmdSources.java](https://app.codecov.io/gh/apache/pulsar/pull/20530?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC10b29scy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2FkbWluL2NsaS9DbWRTb3VyY2VzLmphdmE=) | `45.03% <100.00%> (+45.03%)` | :arrow_up: |
   
   ... and [1425 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/20530/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] Technoboy- merged pull request #20530: [fix][admin] Make admin.cli throw exception instead of silent catch

Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- merged PR #20530:
URL: https://github.com/apache/pulsar/pull/20530


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] tisonkun commented on a diff in pull request #20530: [fix][admin] Make admin.cli throw exception instead of silent catch

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
tisonkun commented on code in PR #20530:
URL: https://github.com/apache/pulsar/pull/20530#discussion_r1223240835


##########
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdClusters.java:
##########
@@ -268,11 +268,9 @@ void run() throws Exception {
             try {
                 processArguments();
             } catch (Exception e) {
-                System.err.println(e.getMessage());
-                System.err.println();
                 String chosenCommand = jcommander.getParsedCommand();
                 getUsageFormatter().usage(chosenCommand);
-                return;
+                throw e;

Review Comment:
   Previously:
   
   ```
   $ bin/pulsar-admin sources create --source-config-file doesnotexist.yaml
   doesnotexist.yaml (No such file or directory)
   
   Submit a Pulsar IO source connector to run in a Pulsar cluster
   Usage: create [options]
   ... other usage prints, and exit with 0
   ```
   
   Now:
   
   ```
   $ bin/pulsar-admin sources create --source-config-file doesnotexist.yaml
   
   Submit a Pulsar IO source connector to run in a Pulsar cluster
   Usage: create [options]
     Options:
       -a, --archive
   ... other usage prints
   
   doesnotexist.yaml (No such file or directory)
   # exit with 1
   ```



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] michaeljmarshall commented on a diff in pull request #20530: [fix][admin] Make admin.cli throw exception instead of silent catch

Posted by "michaeljmarshall (via GitHub)" <gi...@apache.org>.
michaeljmarshall commented on code in PR #20530:
URL: https://github.com/apache/pulsar/pull/20530#discussion_r1223215412


##########
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdClusters.java:
##########
@@ -268,11 +268,9 @@ void run() throws Exception {
             try {
                 processArguments();
             } catch (Exception e) {
-                System.err.println(e.getMessage());
-                System.err.println();
                 String chosenCommand = jcommander.getParsedCommand();
                 getUsageFormatter().usage(chosenCommand);
-                return;
+                throw e;

Review Comment:
   What does the output of a failed call look like now?



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org