Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-8348] [flip6] Print help for DefaultCLI #5233

Closed
Expand Up @@ -58,7 +58,7 @@ public class RemoteExecutor extends PlanExecutor {

private final Configuration clientConfiguration;

private ClusterClient client;
private ClusterClient<?> client;

private int defaultParallelism = 1;

Expand Down
Expand Up @@ -19,9 +19,11 @@
package org.apache.flink.client.cli;

import org.apache.flink.client.ClientUtils;
import org.apache.flink.client.program.ClusterClient;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.HighAvailabilityOptions;
import org.apache.flink.configuration.UnmodifiableConfiguration;
import org.apache.flink.util.FlinkException;
import org.apache.flink.util.Preconditions;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
Expand All @@ -35,9 +37,8 @@
* Base class for {@link CustomCommandLine} implementations which specify a JobManager address and
* a ZooKeeper namespace.
*
* @param <C> type of the ClusterClient which is returned
*/
public abstract class AbstractCustomCommandLine<C extends ClusterClient> implements CustomCommandLine<C> {
public abstract class AbstractCustomCommandLine<T> implements CustomCommandLine<T> {

protected final Option zookeeperNamespaceOption = new Option("z", "zookeeperNamespace", true,
"Namespace to create the Zookeeper sub-paths for high availability mode");
Expand All @@ -47,6 +48,16 @@ public abstract class AbstractCustomCommandLine<C extends ClusterClient> impleme
"Address of the JobManager (master) to which to connect. " +
"Use this flag to connect to a different JobManager than the one specified in the configuration.");

protected final Configuration configuration;

protected AbstractCustomCommandLine(Configuration configuration) {
this.configuration = new UnmodifiableConfiguration(Preconditions.checkNotNull(configuration));
}

public Configuration getConfiguration() {
return configuration;
}

@Override
public void addRunOptions(Options baseOptions) {
// nothing to add here
Expand All @@ -61,11 +72,10 @@ public void addGeneralOptions(Options baseOptions) {
/**
* Override configuration settings by specified command line options.
*
* @param configuration to use as the base configuration
* @param commandLine containing the overriding values
* @return Effective configuration with the overriden configuration settings
*/
protected Configuration applyCommandLineOptionsToConfiguration(Configuration configuration, CommandLine commandLine) {
protected Configuration applyCommandLineOptionsToConfiguration(CommandLine commandLine) throws FlinkException {
final Configuration resultingConfiguration = new Configuration(configuration);

if (commandLine.hasOption(addressOption.getOpt())) {
Expand Down