You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by wa...@apache.org on 2022/10/27 02:19:06 UTC
[flink] branch release-1.16 updated: [FLINK-29749][client] Make 'flink info' command could support dynamic properties
This is an automated email from the ASF dual-hosted git repository.
wangyang0918 pushed a commit to branch release-1.16
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.16 by this push:
new 38e90428bf7 [FLINK-29749][client] Make 'flink info' command could support dynamic properties
38e90428bf7 is described below
commit 38e90428bf7e603fdd353243f1edeba3553af2a3
Author: Jacky Lau <li...@gmail.com>
AuthorDate: Thu Oct 27 10:18:59 2022 +0800
[FLINK-29749][client] Make 'flink info' command could support dynamic properties
This closes #21164.
---
.../org/apache/flink/client/cli/CliFrontend.java | 7 ++-----
.../flink/client/cli/CliFrontendInfoTest.java | 22 +++++++++++++++++-----
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java
index f603dc90cda..b224570ebf0 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java
@@ -316,7 +316,7 @@ public class CliFrontend {
final Options commandOptions = CliFrontendParser.getInfoCommandOptions();
- final CommandLine commandLine = CliFrontendParser.parse(commandOptions, args, true);
+ final CommandLine commandLine = getCommandLine(commandOptions, args, true);
final ProgramOptions programOptions = ProgramOptions.create(commandLine);
@@ -720,10 +720,7 @@ public class CliFrontend {
final Options commandOptions = CliFrontendParser.getSavepointCommandOptions();
- final Options commandLineOptions =
- CliFrontendParser.mergeOptions(commandOptions, customCommandLineOptions);
-
- final CommandLine commandLine = CliFrontendParser.parse(commandLineOptions, args, false);
+ final CommandLine commandLine = getCommandLine(commandOptions, args, false);
final SavepointOptions savepointOptions = new SavepointOptions(commandLine);
diff --git a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendInfoTest.java b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendInfoTest.java
index 79136e84a24..1f902ba008d 100644
--- a/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendInfoTest.java
+++ b/flink-clients/src/test/java/org/apache/flink/client/cli/CliFrontendInfoTest.java
@@ -85,17 +85,29 @@ class CliFrontendInfoTest extends CliFrontendTestBase {
}
@Test
- void testShowExecutionPlanWithParallelism() {
+ void testShowExecutionPlanWithCliOptionParallelism() throws Exception {
+ final String[] parameters = {
+ "-p", "17", CliFrontendTestUtils.getTestJarPath(), "--arg", "suffix"
+ };
+ testShowExecutionPlanWithParallelism(parameters, 17);
+ }
+
+ @Test
+ void testShowExecutionPlanWithDynamicPropertiesParallelism() throws Exception {
+ final String[] parameters = {
+ "-Dparallelism.default=15", CliFrontendTestUtils.getTestJarPath(), "--arg", "suffix"
+ };
+ testShowExecutionPlanWithParallelism(parameters, 15);
+ }
+
+ void testShowExecutionPlanWithParallelism(String[] parameters, int expectedParallelism) {
replaceStdOut();
try {
- String[] parameters = {
- "-p", "17", CliFrontendTestUtils.getTestJarPath(), "--arg", "suffix"
- };
Configuration configuration = getConfiguration();
CliFrontend testFrontend =
new CliFrontend(configuration, Collections.singletonList(getCli()));
testFrontend.info(parameters);
- assertThat(buffer.toString()).contains("\"parallelism\" : 17");
+ assertThat(buffer.toString()).contains("\"parallelism\" : " + expectedParallelism);
} catch (Exception e) {
e.printStackTrace();
fail("Program caused an exception: " + e.getMessage());