You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/01/15 09:01:32 UTC

[GitHub] [flink] lingya commented on a change in pull request #14271: [FLINK-12130][clients] Apply command line options to configuration be…

lingya commented on a change in pull request #14271:
URL: https://github.com/apache/flink/pull/14271#discussion_r558080030



##########
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:
       @jiasheng55  @V1ncentzzZ  Any progress about this?




----------------------------------------------------------------
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:
users@infra.apache.org