use of org.apache.flink.streaming.api.environment.StreamExecutionEnvironmentFactory in project flink by apache.
the class ScalaShellRemoteStreamEnvironment method disableAllContextAndOtherEnvironments.
public static void disableAllContextAndOtherEnvironments() {
// we create a context environment that prevents the instantiation of further
// context environments. at the same time, setting the context environment prevents manual
// creation of local and remote environments
StreamExecutionEnvironmentFactory factory = new StreamExecutionEnvironmentFactory() {
@Override
public StreamExecutionEnvironment createExecutionEnvironment() {
throw new UnsupportedOperationException("Execution Environment is already defined" + " for this shell.");
}
};
initializeContextEnvironment(factory);
}
use of org.apache.flink.streaming.api.environment.StreamExecutionEnvironmentFactory in project flink by apache.
the class StreamContextEnvironment method setAsContext.
// --------------------------------------------------------------------------------------------
public static void setAsContext(final PipelineExecutorServiceLoader executorServiceLoader, final Configuration configuration, final ClassLoader userCodeClassLoader, final boolean enforceSingleJobExecution, final boolean suppressSysout) {
StreamExecutionEnvironmentFactory factory = conf -> {
final List<String> errors = new ArrayList<>();
final boolean allowConfigurations = configuration.getBoolean(DeploymentOptions.ALLOW_CLIENT_JOB_CONFIGURATIONS);
if (!allowConfigurations && !conf.toMap().isEmpty()) {
conf.toMap().forEach((k, v) -> errors.add(ConfigurationNotAllowedMessage.ofConfigurationKeyAndValue(k, v)));
}
Configuration mergedConfiguration = new Configuration();
mergedConfiguration.addAll(configuration);
mergedConfiguration.addAll(conf);
return new StreamContextEnvironment(executorServiceLoader, mergedConfiguration, userCodeClassLoader, enforceSingleJobExecution, suppressSysout, allowConfigurations, errors);
};
initializeContextEnvironment(factory);
}
use of org.apache.flink.streaming.api.environment.StreamExecutionEnvironmentFactory in project flink by apache.
the class StreamPlanEnvironment method setAsContext.
public void setAsContext() {
StreamExecutionEnvironmentFactory factory = conf -> {
this.configure(conf, getUserClassloader());
return this;
};
initializeContextEnvironment(factory);
}
use of org.apache.flink.streaming.api.environment.StreamExecutionEnvironmentFactory in project flink by apache.
the class ScalaShellRemoteStreamEnvironment method setAsContext.
public void setAsContext() {
StreamExecutionEnvironmentFactory factory = new StreamExecutionEnvironmentFactory() {
@Override
public StreamExecutionEnvironment createExecutionEnvironment() {
throw new UnsupportedOperationException("Execution Environment is already defined" + " for this shell.");
}
};
initializeContextEnvironment(factory);
}
use of org.apache.flink.streaming.api.environment.StreamExecutionEnvironmentFactory in project flink by apache.
the class TestStreamEnvironment method setAsContext.
// ------------------------------------------------------------------------
/**
* Sets the streaming context environment to a TestStreamEnvironment that runs its programs on
* the given cluster with the given default parallelism.
*
* @param cluster The test cluster to run the test program on.
* @param parallelism The default parallelism for the test programs.
*/
public static void setAsContext(final LocalFlinkMiniCluster cluster, final int parallelism) {
StreamExecutionEnvironmentFactory factory = new StreamExecutionEnvironmentFactory() {
@Override
public StreamExecutionEnvironment createExecutionEnvironment() {
return new TestStreamEnvironment(cluster, parallelism);
}
};
initializeContextEnvironment(factory);
}
Aggregations