Skip to content

Commit

Permalink
[FLINK-15121] Add public constructors for execution environments that…
Browse files Browse the repository at this point in the history
… take Configuration

This makes useful constructors on ExecutionEnvironment public and adds
Javadoc.

This makes the useless zero-argument constructor of
StreamExecutionEnvironment protected and adds Javadoc to
StreamExecutionEnvironment constructors.

This allows creating execution environments with arbitrary executor
configurations, i.e. one can now create an execution environment that
uses a YARN executor.
  • Loading branch information
aljoscha committed Dec 9, 2019
1 parent 59ac518 commit f631df9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,23 @@ public class ExecutionEnvironment {
private final ClassLoader userClassloader;

/**
* Creates a new Execution Environment.
* Creates a new {@link ExecutionEnvironment} that will use the given {@link Configuration} to
* configure the {@link org.apache.flink.core.execution.Executor}.
*/
protected ExecutionEnvironment() {
this(new Configuration());
}

protected ExecutionEnvironment(final Configuration configuration) {
@PublicEvolving
public ExecutionEnvironment(final Configuration configuration) {
this(DefaultExecutorServiceLoader.INSTANCE, configuration, null);
}

protected ExecutionEnvironment(
/**
* Creates a new {@link ExecutionEnvironment} that will use the given {@link
* Configuration} to configure the {@link org.apache.flink.core.execution.Executor}.
*
* <p>In addition, this constructor allows specifying the {@link ExecutorServiceLoader} and
* user code {@link ClassLoader}.
*/
@PublicEvolving
public ExecutionEnvironment(
final ExecutorServiceLoader executorServiceLoader,
final Configuration configuration,
final ClassLoader userClassloader) {
Expand All @@ -156,6 +162,13 @@ protected ExecutionEnvironment(
this.userClassloader = userClassloader == null ? getClass().getClassLoader() : userClassloader;
}

/**
* Creates a new Execution Environment.
*/
protected ExecutionEnvironment() {
this(new Configuration());
}

@Internal
public ClassLoader getUserCodeClassLoader() {
return userClassloader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,28 @@ public class StreamExecutionEnvironment {

public StreamExecutionEnvironment() {
this(new Configuration());
// unfortunately, StreamExecutionEnvironment always (implicitly) had a public constructor.
// This constructor is not useful because the execution environment cannot be used for
// execution. We're keeping this to appease the binary compatibiliy checks.
}

/**
* Creates a new {@link StreamExecutionEnvironment} that will use the given {@link
* Configuration} to configure the {@link org.apache.flink.core.execution.Executor}.
*/
@PublicEvolving
public StreamExecutionEnvironment(final Configuration configuration) {
this(DefaultExecutorServiceLoader.INSTANCE, configuration, null);
}

/**
* Creates a new {@link StreamExecutionEnvironment} that will use the given {@link
* Configuration} to configure the {@link org.apache.flink.core.execution.Executor}.
*
* <p>In addition, this constructor allows specifying the {@link ExecutorServiceLoader} and
* user code {@link ClassLoader}.
*/
@PublicEvolving
public StreamExecutionEnvironment(
final ExecutorServiceLoader executorServiceLoader,
final Configuration configuration,
Expand Down

0 comments on commit f631df9

Please sign in to comment.