jiasheng55 commented on a change in pull request #14271:
URL: https://github.com/apache/flink/pull/14271#discussion_r540062264
##########
File path:
flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java
##########
@@ -630,66 +715,75 @@ public CommandLine getCommandLine(final Options
commandOptions, final String[] a
}
/**
- * Executes the SAVEPOINT action.
- *
- * @param args Command line arguments for the savepoint action.
+ * The 'savepoint' action.
*/
- protected void savepoint(String[] args) throws Exception {
- LOG.info("Running 'savepoint' command.");
+ protected class ActionSavepoint implements
CommandAction<SavepointOptions> {
- final Options commandOptions =
CliFrontendParser.getSavepointCommandOptions();
+ @Override
+ public SavepointOptions parse(String[] args) throws
CliArgsException {
+ final Options commandOptions =
CliFrontendParser.getSavepointCommandOptions();
- final Options commandLineOptions =
CliFrontendParser.mergeOptions(commandOptions, customCommandLineOptions);
+ final Options commandLineOptions =
CliFrontendParser.mergeOptions(commandOptions, customCommandLineOptions);
- final CommandLine commandLine =
CliFrontendParser.parse(commandLineOptions, args, false);
+ final CommandLine commandLine =
CliFrontendParser.parse(commandLineOptions, args, false);
- final SavepointOptions savepointOptions = new
SavepointOptions(commandLine);
+ return new SavepointOptions(commandLine);
+ }
- // evaluate help flag
- if (savepointOptions.isPrintHelp()) {
-
CliFrontendParser.printHelpForSavepoint(customCommandLines);
- return;
+ @Override
+ public Configuration getConfiguration(
+ SavepointOptions options,
+ CustomCommandLine activeCommandLine) throws Exception {
+ return getEffectiveConfiguration(activeCommandLine,
options.getCommandLine());
}
- final CustomCommandLine activeCommandLine =
validateAndGetActiveCommandLine(commandLine);
+ @Override
+ public int runAction(
+ SavepointOptions options,
+ Configuration configuration) throws Exception {
+ LOG.info("Running 'savepoint' command.");
- if (savepointOptions.isDispose()) {
- runClusterAction(
- activeCommandLine,
- commandLine,
- clusterClient ->
disposeSavepoint(clusterClient, savepointOptions.getSavepointPath()));
- } else {
- String[] cleanedArgs = savepointOptions.getArgs();
+ if (options.isDispose()) {
+ runClusterAction(
+ configuration,
+ clusterClient ->
disposeSavepoint(clusterClient, options.getSavepointPath()));
+ } else {
Review comment:
@V1ncentzzZ the indention "problem" is caused by this `else` bock.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]