Search in sources :

Example 6 with StreamExecutionEnvironmentFactory

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 and the specified jar files and class
 * paths.
 *
 * @param miniCluster The MiniCluster to execute jobs on.
 * @param parallelism The default parallelism for the test programs.
 * @param jarFiles Additional jar files to execute the job with
 * @param classpaths Additional class paths to execute the job with
 */
public static void setAsContext(final MiniCluster miniCluster, final int parallelism, final Collection<Path> jarFiles, final Collection<URL> classpaths) {
    StreamExecutionEnvironmentFactory factory = conf -> {
        TestStreamEnvironment env = new TestStreamEnvironment(miniCluster, conf, parallelism, jarFiles, classpaths);
        randomizeConfiguration(miniCluster, conf);
        env.configure(conf, env.getUserClassloader());
        return env;
    };
    initializeContextEnvironment(factory);
}
Also used : LOCAL_RECOVERY(org.apache.flink.configuration.CheckpointingOptions.LOCAL_RECOVERY) MiniClusterPipelineExecutorServiceLoader(org.apache.flink.test.util.MiniClusterPipelineExecutorServiceLoader) URL(java.net.URL) StateChangelogOptions(org.apache.flink.configuration.StateChangelogOptions) StreamExecutionEnvironmentFactory(org.apache.flink.streaming.api.environment.StreamExecutionEnvironmentFactory) Collection(java.util.Collection) Configuration(org.apache.flink.configuration.Configuration) ReadableConfig(org.apache.flink.configuration.ReadableConfig) Path(org.apache.flink.core.fs.Path) ExecutionCheckpointingOptions(org.apache.flink.streaming.api.environment.ExecutionCheckpointingOptions) Duration(java.time.Duration) MiniCluster(org.apache.flink.runtime.minicluster.MiniCluster) PseudoRandomValueSelector.randomize(org.apache.flink.runtime.testutils.PseudoRandomValueSelector.randomize) Collections(java.util.Collections) StreamExecutionEnvironment(org.apache.flink.streaming.api.environment.StreamExecutionEnvironment) StreamExecutionEnvironmentFactory(org.apache.flink.streaming.api.environment.StreamExecutionEnvironmentFactory)

Aggregations

StreamExecutionEnvironmentFactory (org.apache.flink.streaming.api.environment.StreamExecutionEnvironmentFactory)6 Configuration (org.apache.flink.configuration.Configuration)3 StreamExecutionEnvironment (org.apache.flink.streaming.api.environment.StreamExecutionEnvironment)3 Collection (java.util.Collection)2 Collections (java.util.Collections)2 PublicEvolving (org.apache.flink.annotation.PublicEvolving)2 JobClient (org.apache.flink.core.execution.JobClient)2 StreamGraph (org.apache.flink.streaming.api.graph.StreamGraph)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 ObjectOutputStream (java.io.ObjectOutputStream)1 Serializable (java.io.Serializable)1 URL (java.net.URL)1 Duration (java.time.Duration)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 TimeUnit (java.util.concurrent.TimeUnit)1 Internal (org.apache.flink.annotation.Internal)1