-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#837] feat: Display information of all application through Cli. #964
Conversation
The code still needs to be improved and will be submitted again soon. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #964 +/- ##
============================================
+ Coverage 54.27% 54.81% +0.53%
- Complexity 2550 2572 +22
============================================
Files 386 371 -15
Lines 21828 19924 -1904
Branches 1807 1863 +56
============================================
- Hits 11848 10921 -927
+ Misses 9278 8369 -909
+ Partials 702 634 -68 ☔ View full report in Codecov by Sentry. |
@jerqi The function of the code has been completed, and I will add unit tests and screenshots of the test environment as soon as possible.
|
is it possible to output applications in json format? That way, it would be easier to pipe the result to other command line tools. |
Thanks for the suggestion! I will try to use json to output the result. |
I think current output is fine. It’s nice to have an option to output in json format. |
Thanks for your suggestions! I will improve this part of the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @slfan1989 Gernally lgtm except for some minor comment ! Could you resolve these conflicts first?
|
||
if (cmd.hasOption(uniffleApplicationCli.getOpt())) { | ||
LOG.info("uniffle-client-cli : get applications"); | ||
PrintWriter writer = new PrintWriter(new OutputStreamWriter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use try-resource
? I think we need to close these stream finally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will modify code.
uniffleApplicationCli = new Option(shortPrefix + "apps", longPrefix + "applications", | ||
true, "The command will be used to print a list of applications. \n" | ||
+ "We usually use the command like this: \n" | ||
+ "uniffle -apps|--applications application_167671938823_0001,application_167671938823_0002"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -45,6 +50,7 @@ public class RestClientImpl implements RestClient { | |||
private static final Logger LOG = LoggerFactory.getLogger(RestClientImpl.class); | |||
private CloseableHttpClient httpclient; | |||
private String baseUrl; | |||
final ObjectMapper mapper = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this need to be private
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing the code, I will modify code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @smallzhongfeng @advancedxy @slfan1989
Seems like there are still some merge conflict, would you mind to resolve it first? |
@advancedxy @smallzhongfeng @jerqi Can you help to review this PR again? Thank you very much! |
cli/pom.xml
Outdated
@@ -49,5 +49,9 @@ | |||
<groupId>org.apache.httpcomponents</groupId> | |||
<artifactId>httpclient</artifactId> | |||
</dependency> | |||
<dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do cli
depend on coordinator
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed this issue. this is because I need to use the application object, this object I put it in common.
conf/log4j.properties
Outdated
log4j.appender.console=org.apache.log4j.ConsoleAppender | ||
log4j.appender.console.Threshold=INFO | ||
log4j.appender.console.target=System.err | ||
log4j.appender.console.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n | ||
log4j.appender.RollingAppender=org.apache.log4j.RollingFileAppender |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we remove them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for your help to review the code! I will revert this part of the change. When I was testing locally, I modified this file.
@advancedxy @jerqi Can you help to review this PR again? I have made improvements based on suggestions, including adding support for |
You can run the command to fix style issues
|
Ah, this pr is getting bigger and bigger. Let's address the existing comments here and get it merged first. New options and refines could be done in follow up prs. |
+1, I think we should merge it at first, other features could be added slowly in the future to reduce the cost of review. |
if (!result) { | ||
final String exceptionErrorMsg = | ||
"Timed out waiting for condition. " | ||
+ (org.apache.commons.lang3.StringUtils.isNotEmpty(errorMsg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we import this package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing the code, I will fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also cc @advancedxy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
It took too long, let's merge it first and do some refines in follow up prs.
Thanks @slfan1989 for your work. Merged. |
@smallzhongfeng @advancedxy Thank you very much for helping to review the code! |
What changes were proposed in this pull request?
Why are the changes needed?
fixes #837 [Subtask] Display information of all application through Cli.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Add Junit Test & Test environment verification