You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by al...@apache.org on 2020/01/23 10:27:21 UTC

[flink] 05/07: [FLINK-15276] List available executors in ExecutorCLI

This is an automated email from the ASF dual-hosted git repository.

aljoscha pushed a commit to branch release-1.10
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 8d30da73ef0b40fdebc28118657347162ff0dba4
Author: Aljoscha Krettek <al...@apache.org>
AuthorDate: Wed Jan 22 12:27:18 2020 +0100

    [FLINK-15276] List available executors in ExecutorCLI
---
 docs/ops/cli.md                                    | 30 ++++++++++++++--------
 .../org/apache/flink/client/cli/ExecutorCLI.java   | 13 ++++++++--
 2 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/docs/ops/cli.md b/docs/ops/cli.md
index 6991b80..1ce26e6 100644
--- a/docs/ops/cli.md
+++ b/docs/ops/cli.md
@@ -438,8 +438,10 @@ Action "run" compiles and runs a program.
                            https://ci.apache.org/projects/flink/flink-docs-stabl
                            e/ops/config.html
      -e,--executor <arg>   The name of the executor to be used for executing the
-                           given job, e.g. "local". This is equivalent to the
-                           "execution.target" config option.
+                           given job, which is equivalent to the
+                           "execution.target" config option. The currently
+                           available executors are: "remote", "local",
+                           "kubernetes-session", "yarn-per-job", "yarn-session".
 
   Options for default mode:
      -m,--jobmanager <arg>           Address of the JobManager (master) to which
@@ -488,8 +490,10 @@ Action "list" lists running and scheduled programs.
                            https://ci.apache.org/projects/flink/flink-docs-stabl
                            e/ops/config.html
      -e,--executor <arg>   The name of the executor to be used for executing the
-                           given job, e.g. "local". This is equivalent to the
-                           "execution.target" config option.
+                           given job, which is equivalent to the
+                           "execution.target" config option. The currently
+                           available executors are: "remote", "local",
+                           "kubernetes-session", "yarn-per-job", "yarn-session".
 
   Options for default mode:
      -m,--jobmanager <arg>           Address of the JobManager (master) to which
@@ -528,8 +532,10 @@ Action "stop" stops a running program with a savepoint (streaming jobs only).
                            https://ci.apache.org/projects/flink/flink-docs-stabl
                            e/ops/config.html
      -e,--executor <arg>   The name of the executor to be used for executing the
-                           given job, e.g. "local". This is equivalent to the
-                           "execution.target" config option.
+                           given job, which is equivalent to the
+                           "execution.target" config option. The currently
+                           available executors are: "remote", "local",
+                           "kubernetes-session", "yarn-per-job", "yarn-session".
 
   Options for default mode:
      -m,--jobmanager <arg>           Address of the JobManager (master) to which
@@ -569,8 +575,10 @@ Action "cancel" cancels a running program.
                            https://ci.apache.org/projects/flink/flink-docs-stabl
                            e/ops/config.html
      -e,--executor <arg>   The name of the executor to be used for executing the
-                           given job, e.g. "local". This is equivalent to the
-                           "execution.target" config option.
+                           given job, which is equivalent to the
+                           "execution.target" config option. The currently
+                           available executors are: "remote", "local",
+                           "kubernetes-session", "yarn-per-job", "yarn-session".
 
   Options for default mode:
      -m,--jobmanager <arg>           Address of the JobManager (master) to which
@@ -604,8 +612,10 @@ Action "savepoint" triggers savepoints for a running job or disposes existing on
                            https://ci.apache.org/projects/flink/flink-docs-stabl
                            e/ops/config.html
      -e,--executor <arg>   The name of the executor to be used for executing the
-                           given job, e.g. "local". This is equivalent to the
-                           "execution.target" config option.
+                           given job, which is equivalent to the
+                           "execution.target" config option. The currently
+                           available executors are: "remote", "local",
+                           "kubernetes-session", "yarn-per-job", "yarn-session".
 
   Options for default mode:
      -m,--jobmanager <arg>           Address of the JobManager (master) to which
diff --git a/flink-clients/src/main/java/org/apache/flink/client/cli/ExecutorCLI.java b/flink-clients/src/main/java/org/apache/flink/client/cli/ExecutorCLI.java
index 0f79e31..4b808a8 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/cli/ExecutorCLI.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/cli/ExecutorCLI.java
@@ -22,6 +22,7 @@ import org.apache.flink.annotation.Internal;
 import org.apache.flink.configuration.Configuration;
 import org.apache.flink.configuration.DeploymentOptions;
 import org.apache.flink.configuration.UnmodifiableConfiguration;
+import org.apache.flink.core.execution.DefaultExecutorServiceLoader;
 import org.apache.flink.core.execution.PipelineExecutor;
 
 import org.apache.commons.cli.CommandLine;
@@ -31,6 +32,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.Properties;
+import java.util.stream.Collectors;
 
 import static org.apache.flink.util.Preconditions.checkNotNull;
 
@@ -48,8 +50,9 @@ public class ExecutorCLI implements CustomCommandLine {
 	private static final String ID = "executor";
 
 	private final Option executorOption = new Option("e", "executor", true,
-			"The name of the executor to be used for executing the given job, e.g. \"local\"." +
-					" This is equivalent to the \"" + DeploymentOptions.TARGET.key() + "\" config option.");
+			"The name of the executor to be used for executing the given job, which is equivalent " +
+					"to the \"" + DeploymentOptions.TARGET.key() + "\" config option. The " +
+					"currently available executors are: " + getExecutorFactoryNames() + ".");
 
 	/**
 	 * Dynamic properties allow the user to specify additional configuration values with -D, such as
@@ -122,4 +125,10 @@ public class ExecutorCLI implements CustomCommandLine {
 					}
 				});
 	}
+
+	private static String getExecutorFactoryNames() {
+		return DefaultExecutorServiceLoader.INSTANCE.getExecutorNames()
+				.map(name -> String.format("\"%s\"", name))
+				.collect(Collectors.joining(", "));
+	}
 }