Skip to content

Commit

Permalink
[FLINK-15276] List available executors in ExecutorCLI
Browse files Browse the repository at this point in the history
  • Loading branch information
aljoscha committed Jan 23, 2020
1 parent d9532e3 commit 6e63632
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
30 changes: 20 additions & 10 deletions docs/ops/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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;
Expand All @@ -31,6 +32,7 @@
import org.slf4j.LoggerFactory;

import java.util.Properties;
import java.util.stream.Collectors;

import static org.apache.flink.util.Preconditions.checkNotNull;

Expand All @@ -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
Expand Down Expand Up @@ -122,4 +125,10 @@ private void encodeDynamicProperties(final CommandLine commandLine, final Config
}
});
}

private static String getExecutorFactoryNames() {
return DefaultExecutorServiceLoader.INSTANCE.getExecutorNames()
.map(name -> String.format("\"%s\"", name))
.collect(Collectors.joining(", "));
}
}

0 comments on commit 6e63632

Please sign in to comment.