Search in sources :

Example 6 with ShuffleEnvironment

use of org.apache.flink.runtime.shuffle.ShuffleEnvironment in project flink by apache.

the class AbstractUdfStreamOperatorLifecycleTest method testLifeCycleFull.

@Test
public void testLifeCycleFull() throws Exception {
    ACTUAL_ORDER_TRACKING.clear();
    Configuration taskManagerConfig = new Configuration();
    StreamConfig cfg = new StreamConfig(new Configuration());
    MockSourceFunction srcFun = new MockSourceFunction();
    cfg.setStreamOperator(new LifecycleTrackingStreamSource<>(srcFun, true));
    cfg.setOperatorID(new OperatorID());
    cfg.setTimeCharacteristic(TimeCharacteristic.ProcessingTime);
    try (ShuffleEnvironment shuffleEnvironment = new NettyShuffleEnvironmentBuilder().build()) {
        Task task = StreamTaskTest.createTask(SourceStreamTask.class, shuffleEnvironment, cfg, taskManagerConfig);
        task.startTaskThread();
        LifecycleTrackingStreamSource.runStarted.await();
        // wait for clean termination
        task.getExecutingThread().join();
        assertEquals(ExecutionState.FINISHED, task.getExecutionState());
        assertEquals(EXPECTED_CALL_ORDER_FULL, ACTUAL_ORDER_TRACKING);
    }
}
Also used : ShuffleEnvironment(org.apache.flink.runtime.shuffle.ShuffleEnvironment) SourceStreamTask(org.apache.flink.streaming.runtime.tasks.SourceStreamTask) StreamTask(org.apache.flink.streaming.runtime.tasks.StreamTask) Task(org.apache.flink.runtime.taskmanager.Task) Configuration(org.apache.flink.configuration.Configuration) StreamConfig(org.apache.flink.streaming.api.graph.StreamConfig) NettyShuffleEnvironmentBuilder(org.apache.flink.runtime.io.network.NettyShuffleEnvironmentBuilder) OperatorID(org.apache.flink.runtime.jobgraph.OperatorID) Test(org.junit.Test) StreamTaskTest(org.apache.flink.streaming.runtime.tasks.StreamTaskTest)

Aggregations

NettyShuffleEnvironmentBuilder (org.apache.flink.runtime.io.network.NettyShuffleEnvironmentBuilder)6 ShuffleEnvironment (org.apache.flink.runtime.shuffle.ShuffleEnvironment)6 Configuration (org.apache.flink.configuration.Configuration)5 Test (org.junit.Test)5 Task (org.apache.flink.runtime.taskmanager.Task)4 Collections (java.util.Collections)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)2 JobID (org.apache.flink.api.common.JobID)2 OneShotLatch (org.apache.flink.core.testutils.OneShotLatch)2 ResultPartitionDeploymentDescriptor (org.apache.flink.runtime.deployment.ResultPartitionDeploymentDescriptor)2 Environment (org.apache.flink.runtime.execution.Environment)2 ExecutionState (org.apache.flink.runtime.execution.ExecutionState)2 ExecutionAttemptID (org.apache.flink.runtime.executiongraph.ExecutionAttemptID)2 ExternalResourceInfoProvider (org.apache.flink.runtime.externalresource.ExternalResourceInfoProvider)2 OperatorID (org.apache.flink.runtime.jobgraph.OperatorID)2 AbstractInvokable (org.apache.flink.runtime.jobgraph.tasks.AbstractInvokable)2 UnregisteredMetricGroups (org.apache.flink.runtime.metrics.groups.UnregisteredMetricGroups)2 StreamConfig (org.apache.flink.streaming.api.graph.StreamConfig)2 SerializedValue (org.apache.flink.util.SerializedValue)2