org.apache.flink.runtime.util.TestingTaskManagerRuntimeInfo Java Examples
The following examples show how to use
org.apache.flink.runtime.util.TestingTaskManagerRuntimeInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BinaryOperatorTestBase.java From flink with Apache License 2.0 | 6 votes |
protected BinaryOperatorTestBase(ExecutionConfig executionConfig, long memory, int maxNumSorters, long perSortMemory) { if (memory < 0 || maxNumSorters < 0 || perSortMemory < 0) { throw new IllegalArgumentException(); } final long totalMem = Math.max(memory, 0) + (Math.max(maxNumSorters, 0) * perSortMemory); this.perSortMem = perSortMemory; this.perSortFractionMem = (double) perSortMemory / totalMem; this.ioManager = new IOManagerAsync(); this.memManager = totalMem > 0 ? new MemoryManager(totalMem, 1) : null; this.inputs = new ArrayList<>(); this.comparators = new ArrayList<>(); this.sorters = new ArrayList<>(); this.owner = new DummyInvokable(); this.taskConfig = new TaskConfig(new Configuration()); this.executionConfig = executionConfig; this.taskManageInfo = new TestingTaskManagerRuntimeInfo(); }
Example #2
Source File: StreamSourceOperatorLatencyMetricsTest.java From flink with Apache License 2.0 | 6 votes |
/** * Verifies that latency metrics can be disabled via the {@link ExecutionConfig} even if they are enabled via * the configuration. */ @Test public void testLatencyMarkEmissionDisabledOverrideViaExecutionConfig() throws Exception { testLatencyMarkEmission(0, (operator, timeProvider) -> { Configuration tmConfig = new Configuration(); tmConfig.setLong(MetricOptions.LATENCY_INTERVAL, latencyMarkInterval); Environment env = MockEnvironment.builder() .setTaskManagerRuntimeInfo(new TestingTaskManagerRuntimeInfo(tmConfig)) .build(); ExecutionConfig executionConfig = new ExecutionConfig(); executionConfig.setLatencyTrackingInterval(0); setupSourceOperator(operator, executionConfig, env, timeProvider); }); }
Example #3
Source File: StreamSourceOperatorLatencyMetricsTest.java From flink with Apache License 2.0 | 6 votes |
/** * Verifies that latency metrics can be enabled via the {@link ExecutionConfig} even if they are disabled via * the configuration. */ @Test public void testLatencyMarkEmissionEnabledOverrideViaExecutionConfig() throws Exception { testLatencyMarkEmission((int) (maxProcessingTime / latencyMarkInterval) + 1, (operator, timeProvider) -> { ExecutionConfig executionConfig = new ExecutionConfig(); executionConfig.setLatencyTrackingInterval(latencyMarkInterval); Configuration tmConfig = new Configuration(); tmConfig.setLong(MetricOptions.LATENCY_INTERVAL, 0L); Environment env = MockEnvironment.builder() .setTaskManagerRuntimeInfo(new TestingTaskManagerRuntimeInfo(tmConfig)) .build(); setupSourceOperator(operator, executionConfig, env, timeProvider); }); }
Example #4
Source File: BinaryOperatorTestBase.java From flink with Apache License 2.0 | 6 votes |
protected BinaryOperatorTestBase(ExecutionConfig executionConfig, long memory, int maxNumSorters, long perSortMemory) { if (memory < 0 || maxNumSorters < 0 || perSortMemory < 0) { throw new IllegalArgumentException(); } final long totalMem = Math.max(memory, 0) + (Math.max(maxNumSorters, 0) * perSortMemory); this.perSortMem = perSortMemory; this.perSortFractionMem = (double) perSortMemory / totalMem; this.ioManager = new IOManagerAsync(); this.memManager = totalMem > 0 ? MemoryManagerBuilder.newBuilder().setMemorySize(totalMem).build() : null; this.inputs = new ArrayList<>(); this.comparators = new ArrayList<>(); this.sorters = new ArrayList<>(); this.owner = new DummyInvokable(); this.taskConfig = new TaskConfig(new Configuration()); this.executionConfig = executionConfig; this.taskManageInfo = new TestingTaskManagerRuntimeInfo(); }
Example #5
Source File: UnaryOperatorTestBase.java From flink with Apache License 2.0 | 6 votes |
protected UnaryOperatorTestBase(ExecutionConfig executionConfig, long memory, int maxNumSorters, long perSortMemory) { if (memory < 0 || maxNumSorters < 0 || perSortMemory < 0) { throw new IllegalArgumentException(); } final long totalMem = Math.max(memory, 0) + (Math.max(maxNumSorters, 0) * perSortMemory); this.perSortMem = perSortMemory; this.perSortFractionMem = (double)perSortMemory/totalMem; this.ioManager = new IOManagerAsync(); this.memManager = totalMem > 0 ? MemoryManagerBuilder.newBuilder().setMemorySize(totalMem).build() : null; this.owner = new DummyInvokable(); Configuration config = new Configuration(); this.taskConfig = new TaskConfig(config); this.executionConfig = executionConfig; this.comparators = new ArrayList<TypeComparator<IN>>(2); this.taskManageInfo = new TestingTaskManagerRuntimeInfo(); }
Example #6
Source File: DriverTestBase.java From flink with Apache License 2.0 | 6 votes |
protected DriverTestBase(ExecutionConfig executionConfig, long memory, int maxNumSorters, long perSortMemory) { if (memory < 0 || maxNumSorters < 0 || perSortMemory < 0) { throw new IllegalArgumentException(); } final long totalMem = Math.max(memory, 0) + (Math.max(maxNumSorters, 0) * perSortMemory); this.perSortMem = perSortMemory; this.perSortFractionMem = (double)perSortMemory/totalMem; this.ioManager = new IOManagerAsync(); this.memManager = totalMem > 0 ? MemoryManagerBuilder.newBuilder().setMemorySize(totalMem).build() : null; this.inputs = new ArrayList<MutableObjectIterator<Record>>(); this.comparators = new ArrayList<TypeComparator<Record>>(); this.sorters = new ArrayList<UnilateralSortMerger<Record>>(); this.owner = new DummyInvokable(); this.taskConfig = new TaskConfig(new Configuration()); this.executionConfig = executionConfig; this.taskManageInfo = new TestingTaskManagerRuntimeInfo(); }
Example #7
Source File: StreamSourceOperatorLatencyMetricsTest.java From flink with Apache License 2.0 | 6 votes |
/** * Verifies that latency metrics can be disabled via the {@link ExecutionConfig} even if they are enabled via * the configuration. */ @Test public void testLatencyMarkEmissionDisabledOverrideViaExecutionConfig() throws Exception { testLatencyMarkEmission(0, (operator, timeProvider) -> { Configuration tmConfig = new Configuration(); tmConfig.setLong(MetricOptions.LATENCY_INTERVAL, latencyMarkInterval); Environment env = MockEnvironment.builder() .setTaskManagerRuntimeInfo(new TestingTaskManagerRuntimeInfo(tmConfig)) .build(); ExecutionConfig executionConfig = new ExecutionConfig(); executionConfig.setLatencyTrackingInterval(0); setupSourceOperator(operator, executionConfig, env, timeProvider); }); }
Example #8
Source File: StreamSourceOperatorLatencyMetricsTest.java From flink with Apache License 2.0 | 6 votes |
/** * Verifies that latency metrics can be enabled via the {@link ExecutionConfig} even if they are disabled via * the configuration. */ @Test public void testLatencyMarkEmissionEnabledOverrideViaExecutionConfig() throws Exception { testLatencyMarkEmission((int) (maxProcessingTime / latencyMarkInterval) + 1, (operator, timeProvider) -> { ExecutionConfig executionConfig = new ExecutionConfig(); executionConfig.setLatencyTrackingInterval(latencyMarkInterval); Configuration tmConfig = new Configuration(); tmConfig.setLong(MetricOptions.LATENCY_INTERVAL, 0L); Environment env = MockEnvironment.builder() .setTaskManagerRuntimeInfo(new TestingTaskManagerRuntimeInfo(tmConfig)) .build(); setupSourceOperator(operator, executionConfig, env, timeProvider); }); }
Example #9
Source File: UnaryOperatorTestBase.java From flink with Apache License 2.0 | 6 votes |
protected UnaryOperatorTestBase(ExecutionConfig executionConfig, long memory, int maxNumSorters, long perSortMemory) { if (memory < 0 || maxNumSorters < 0 || perSortMemory < 0) { throw new IllegalArgumentException(); } final long totalMem = Math.max(memory, 0) + (Math.max(maxNumSorters, 0) * perSortMemory); this.perSortMem = perSortMemory; this.perSortFractionMem = (double)perSortMemory/totalMem; this.ioManager = new IOManagerAsync(); this.memManager = totalMem > 0 ? new MemoryManager(totalMem, 1) : null; this.owner = new DummyInvokable(); Configuration config = new Configuration(); this.taskConfig = new TaskConfig(config); this.executionConfig = executionConfig; this.comparators = new ArrayList<TypeComparator<IN>>(2); this.taskManageInfo = new TestingTaskManagerRuntimeInfo(); }
Example #10
Source File: DriverTestBase.java From flink with Apache License 2.0 | 6 votes |
protected DriverTestBase(ExecutionConfig executionConfig, long memory, int maxNumSorters, long perSortMemory) { if (memory < 0 || maxNumSorters < 0 || perSortMemory < 0) { throw new IllegalArgumentException(); } final long totalMem = Math.max(memory, 0) + (Math.max(maxNumSorters, 0) * perSortMemory); this.perSortMem = perSortMemory; this.perSortFractionMem = (double)perSortMemory/totalMem; this.ioManager = new IOManagerAsync(); this.memManager = totalMem > 0 ? new MemoryManager(totalMem,1) : null; this.inputs = new ArrayList<MutableObjectIterator<Record>>(); this.comparators = new ArrayList<TypeComparator<Record>>(); this.sorters = new ArrayList<UnilateralSortMerger<Record>>(); this.owner = new DummyInvokable(); this.taskConfig = new TaskConfig(new Configuration()); this.executionConfig = executionConfig; this.taskManageInfo = new TestingTaskManagerRuntimeInfo(); }
Example #11
Source File: StreamSourceOperatorLatencyMetricsTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * Verifies that latency metrics can be disabled via the {@link ExecutionConfig} even if they are enabled via * the configuration. */ @Test public void testLatencyMarkEmissionDisabledOverrideViaExecutionConfig() throws Exception { testLatencyMarkEmission(0, (operator, timeProvider) -> { Configuration tmConfig = new Configuration(); tmConfig.setLong(MetricOptions.LATENCY_INTERVAL, latencyMarkInterval); Environment env = MockEnvironment.builder() .setTaskManagerRuntimeInfo(new TestingTaskManagerRuntimeInfo(tmConfig)) .build(); ExecutionConfig executionConfig = new ExecutionConfig(); executionConfig.setLatencyTrackingInterval(0); setupSourceOperator(operator, executionConfig, env, timeProvider); }); }
Example #12
Source File: StreamSourceOperatorLatencyMetricsTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
/** * Verifies that latency metrics can be enabled via the {@link ExecutionConfig} even if they are disabled via * the configuration. */ @Test public void testLatencyMarkEmissionEnabledOverrideViaExecutionConfig() throws Exception { testLatencyMarkEmission((int) (maxProcessingTime / latencyMarkInterval) + 1, (operator, timeProvider) -> { ExecutionConfig executionConfig = new ExecutionConfig(); executionConfig.setLatencyTrackingInterval(latencyMarkInterval); Configuration tmConfig = new Configuration(); tmConfig.setLong(MetricOptions.LATENCY_INTERVAL, 0L); Environment env = MockEnvironment.builder() .setTaskManagerRuntimeInfo(new TestingTaskManagerRuntimeInfo(tmConfig)) .build(); setupSourceOperator(operator, executionConfig, env, timeProvider); }); }
Example #13
Source File: UnaryOperatorTestBase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
protected UnaryOperatorTestBase(ExecutionConfig executionConfig, long memory, int maxNumSorters, long perSortMemory) { if (memory < 0 || maxNumSorters < 0 || perSortMemory < 0) { throw new IllegalArgumentException(); } final long totalMem = Math.max(memory, 0) + (Math.max(maxNumSorters, 0) * perSortMemory); this.perSortMem = perSortMemory; this.perSortFractionMem = (double)perSortMemory/totalMem; this.ioManager = new IOManagerAsync(); this.memManager = totalMem > 0 ? new MemoryManager(totalMem, 1) : null; this.owner = new DummyInvokable(); Configuration config = new Configuration(); this.taskConfig = new TaskConfig(config); this.executionConfig = executionConfig; this.comparators = new ArrayList<TypeComparator<IN>>(2); this.taskManageInfo = new TestingTaskManagerRuntimeInfo(); }
Example #14
Source File: DriverTestBase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
protected DriverTestBase(ExecutionConfig executionConfig, long memory, int maxNumSorters, long perSortMemory) { if (memory < 0 || maxNumSorters < 0 || perSortMemory < 0) { throw new IllegalArgumentException(); } final long totalMem = Math.max(memory, 0) + (Math.max(maxNumSorters, 0) * perSortMemory); this.perSortMem = perSortMemory; this.perSortFractionMem = (double)perSortMemory/totalMem; this.ioManager = new IOManagerAsync(); this.memManager = totalMem > 0 ? new MemoryManager(totalMem,1) : null; this.inputs = new ArrayList<MutableObjectIterator<Record>>(); this.comparators = new ArrayList<TypeComparator<Record>>(); this.sorters = new ArrayList<UnilateralSortMerger<Record>>(); this.owner = new DummyInvokable(); this.taskConfig = new TaskConfig(new Configuration()); this.executionConfig = executionConfig; this.taskManageInfo = new TestingTaskManagerRuntimeInfo(); }
Example #15
Source File: BinaryOperatorTestBase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
protected BinaryOperatorTestBase(ExecutionConfig executionConfig, long memory, int maxNumSorters, long perSortMemory) { if (memory < 0 || maxNumSorters < 0 || perSortMemory < 0) { throw new IllegalArgumentException(); } final long totalMem = Math.max(memory, 0) + (Math.max(maxNumSorters, 0) * perSortMemory); this.perSortMem = perSortMemory; this.perSortFractionMem = (double) perSortMemory / totalMem; this.ioManager = new IOManagerAsync(); this.memManager = totalMem > 0 ? new MemoryManager(totalMem, 1) : null; this.inputs = new ArrayList<>(); this.comparators = new ArrayList<>(); this.sorters = new ArrayList<>(); this.owner = new DummyInvokable(); this.taskConfig = new TaskConfig(new Configuration()); this.executionConfig = executionConfig; this.taskManageInfo = new TestingTaskManagerRuntimeInfo(); }
Example #16
Source File: RocksDBStateBackendConfigTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
static Environment getMockEnvironment(File... tempDirs) { final String[] tempDirStrings = new String[tempDirs.length]; for (int i = 0; i < tempDirs.length; i++) { tempDirStrings[i] = tempDirs[i].getAbsolutePath(); } IOManager ioMan = mock(IOManager.class); when(ioMan.getSpillingDirectories()).thenReturn(tempDirs); Environment env = mock(Environment.class); when(env.getJobID()).thenReturn(new JobID()); when(env.getUserClassLoader()).thenReturn(RocksDBStateBackendConfigTest.class.getClassLoader()); when(env.getIOManager()).thenReturn(ioMan); when(env.getTaskKvStateRegistry()).thenReturn(new KvStateRegistry().createTaskRegistry(new JobID(), new JobVertexID())); TaskInfo taskInfo = mock(TaskInfo.class); when(env.getTaskInfo()).thenReturn(taskInfo); when(taskInfo.getIndexOfThisSubtask()).thenReturn(0); TaskManagerRuntimeInfo tmInfo = new TestingTaskManagerRuntimeInfo(new Configuration(), tempDirStrings); when(env.getTaskManagerInfo()).thenReturn(tmInfo); TestTaskStateManager taskStateManager = new TestTaskStateManager(); when(env.getTaskStateManager()).thenReturn(taskStateManager); return env; }
Example #17
Source File: RocksDBStateBackendConfigTest.java From flink with Apache License 2.0 | 5 votes |
static MockEnvironment getMockEnvironment(File... tempDirs) { final String[] tempDirStrings = new String[tempDirs.length]; for (int i = 0; i < tempDirs.length; i++) { tempDirStrings[i] = tempDirs[i].getAbsolutePath(); } IOManager ioMan = mock(IOManager.class); when(ioMan.getSpillingDirectories()).thenReturn(tempDirs); return MockEnvironment.builder() .setUserCodeClassLoader(RocksDBStateBackendConfigTest.class.getClassLoader()) .setTaskManagerRuntimeInfo(new TestingTaskManagerRuntimeInfo(new Configuration(), tempDirStrings)) .setIOManager(ioMan).build(); }
Example #18
Source File: StreamSourceOperatorLatencyMetricsTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
/** * Verifies that latency metrics can be enabled via the configuration. */ @Test public void testLatencyMarkEmissionEnabledViaFlinkConfig() throws Exception { testLatencyMarkEmission((int) (maxProcessingTime / latencyMarkInterval) + 1, (operator, timeProvider) -> { Configuration tmConfig = new Configuration(); tmConfig.setLong(MetricOptions.LATENCY_INTERVAL, latencyMarkInterval); Environment env = MockEnvironment.builder() .setTaskManagerRuntimeInfo(new TestingTaskManagerRuntimeInfo(tmConfig)) .build(); setupSourceOperator(operator, new ExecutionConfig(), env, timeProvider); }); }
Example #19
Source File: StreamSourceOperatorLatencyMetricsTest.java From flink with Apache License 2.0 | 5 votes |
/** * Verifies that latency metrics can be enabled via the configuration. */ @Test public void testLatencyMarkEmissionEnabledViaFlinkConfig() throws Exception { testLatencyMarkEmission((int) (maxProcessingTime / latencyMarkInterval) + 1, (operator, timeProvider) -> { Configuration tmConfig = new Configuration(); tmConfig.setLong(MetricOptions.LATENCY_INTERVAL, latencyMarkInterval); Environment env = MockEnvironment.builder() .setTaskManagerRuntimeInfo(new TestingTaskManagerRuntimeInfo(tmConfig)) .build(); setupSourceOperator(operator, new ExecutionConfig(), env, timeProvider); }); }
Example #20
Source File: TestTaskContext.java From flink with Apache License 2.0 | 5 votes |
public TestTaskContext(long memoryInBytes) { this.memoryManager = MemoryManagerBuilder .newBuilder() .setMemorySize(memoryInBytes) .build(); this.taskManageInfo = new TestingTaskManagerRuntimeInfo(); }
Example #21
Source File: RocksDBStateBackendConfigTest.java From flink with Apache License 2.0 | 5 votes |
static Environment getMockEnvironment(File... tempDirs) { final String[] tempDirStrings = new String[tempDirs.length]; for (int i = 0; i < tempDirs.length; i++) { tempDirStrings[i] = tempDirs[i].getAbsolutePath(); } IOManager ioMan = mock(IOManager.class); when(ioMan.getSpillingDirectories()).thenReturn(tempDirs); Environment env = mock(Environment.class); when(env.getJobID()).thenReturn(new JobID()); when(env.getUserClassLoader()).thenReturn(RocksDBStateBackendConfigTest.class.getClassLoader()); when(env.getIOManager()).thenReturn(ioMan); when(env.getTaskKvStateRegistry()).thenReturn(new KvStateRegistry().createTaskRegistry(new JobID(), new JobVertexID())); TaskInfo taskInfo = mock(TaskInfo.class); when(env.getTaskInfo()).thenReturn(taskInfo); when(taskInfo.getIndexOfThisSubtask()).thenReturn(0); TaskManagerRuntimeInfo tmInfo = new TestingTaskManagerRuntimeInfo(new Configuration(), tempDirStrings); when(env.getTaskManagerInfo()).thenReturn(tmInfo); TestTaskStateManager taskStateManager = new TestTaskStateManager(); when(env.getTaskStateManager()).thenReturn(taskStateManager); return env; }
Example #22
Source File: StreamSourceOperatorLatencyMetricsTest.java From flink with Apache License 2.0 | 5 votes |
/** * Verifies that latency metrics can be enabled via the configuration. */ @Test public void testLatencyMarkEmissionEnabledViaFlinkConfig() throws Exception { testLatencyMarkEmission((int) (maxProcessingTime / latencyMarkInterval) + 1, (operator, timeProvider) -> { Configuration tmConfig = new Configuration(); tmConfig.setLong(MetricOptions.LATENCY_INTERVAL, latencyMarkInterval); Environment env = MockEnvironment.builder() .setTaskManagerRuntimeInfo(new TestingTaskManagerRuntimeInfo(tmConfig)) .build(); setupSourceOperator(operator, new ExecutionConfig(), env, timeProvider); }); }
Example #23
Source File: TaskTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
private Task build() throws Exception { final JobID jobId = new JobID(); final JobVertexID jobVertexId = new JobVertexID(); final ExecutionAttemptID executionAttemptId = new ExecutionAttemptID(); final SerializedValue<ExecutionConfig> serializedExecutionConfig = new SerializedValue<>(executionConfig); final JobInformation jobInformation = new JobInformation( jobId, "Test Job", serializedExecutionConfig, new Configuration(), requiredJarFileBlobKeys, Collections.emptyList()); final TaskInformation taskInformation = new TaskInformation( jobVertexId, "Test Task", 1, 1, invokable.getName(), new Configuration()); final BlobCacheService blobCacheService = new BlobCacheService( mock(PermanentBlobCache.class), mock(TransientBlobCache.class)); final TaskMetricGroup taskMetricGroup = mock(TaskMetricGroup.class); when(taskMetricGroup.getIOMetricGroup()).thenReturn(mock(TaskIOMetricGroup.class)); return new Task( jobInformation, taskInformation, executionAttemptId, new AllocationID(), 0, 0, Collections.emptyList(), Collections.emptyList(), 0, mock(MemoryManager.class), mock(IOManager.class), networkEnvironment, mock(BroadcastVariableManager.class), new TestTaskStateManager(), taskManagerActions, new MockInputSplitProvider(), new TestCheckpointResponder(), new TestGlobalAggregateManager(), blobCacheService, libraryCacheManager, mock(FileCache.class), new TestingTaskManagerRuntimeInfo(taskManagerConfig), taskMetricGroup, consumableNotifier, partitionProducerStateChecker, executor); }
Example #24
Source File: StreamTaskTerminationTest.java From flink with Apache License 2.0 | 4 votes |
/** * FLINK-6833 * * <p>Tests that a finished stream task cannot be failed by an asynchronous checkpointing operation after * the stream task has stopped running. */ @Test public void testConcurrentAsyncCheckpointCannotFailFinishedStreamTask() throws Exception { final Configuration taskConfiguration = new Configuration(); final StreamConfig streamConfig = new StreamConfig(taskConfiguration); final NoOpStreamOperator<Long> noOpStreamOperator = new NoOpStreamOperator<>(); final StateBackend blockingStateBackend = new BlockingStateBackend(); streamConfig.setStreamOperator(noOpStreamOperator); streamConfig.setOperatorID(new OperatorID()); streamConfig.setStateBackend(blockingStateBackend); final long checkpointId = 0L; final long checkpointTimestamp = 0L; final JobInformation jobInformation = new JobInformation( new JobID(), "Test Job", new SerializedValue<>(new ExecutionConfig()), new Configuration(), Collections.emptyList(), Collections.emptyList()); final TaskInformation taskInformation = new TaskInformation( new JobVertexID(), "Test Task", 1, 1, BlockingStreamTask.class.getName(), taskConfiguration); final TaskManagerRuntimeInfo taskManagerRuntimeInfo = new TestingTaskManagerRuntimeInfo(); final ShuffleEnvironment<?, ?> shuffleEnvironment = new NettyShuffleEnvironmentBuilder().build(); final Task task = new Task( jobInformation, taskInformation, new ExecutionAttemptID(), new AllocationID(), 0, 0, Collections.<ResultPartitionDeploymentDescriptor>emptyList(), Collections.<InputGateDeploymentDescriptor>emptyList(), 0, MemoryManagerBuilder.newBuilder().setMemorySize(32L * 1024L).build(), new IOManagerAsync(), shuffleEnvironment, new KvStateService(new KvStateRegistry(), null, null), mock(BroadcastVariableManager.class), new TaskEventDispatcher(), ExternalResourceInfoProvider.NO_EXTERNAL_RESOURCES, new TestTaskStateManager(), mock(TaskManagerActions.class), mock(InputSplitProvider.class), mock(CheckpointResponder.class), new NoOpTaskOperatorEventGateway(), new TestGlobalAggregateManager(), TestingClassLoaderLease.newBuilder().build(), mock(FileCache.class), taskManagerRuntimeInfo, UnregisteredMetricGroups.createUnregisteredTaskMetricGroup(), new NoOpResultPartitionConsumableNotifier(), mock(PartitionProducerStateChecker.class), Executors.directExecutor()); CompletableFuture<Void> taskRun = CompletableFuture.runAsync( () -> task.run(), TestingUtils.defaultExecutor()); // wait until the stream task started running RUN_LATCH.await(); // trigger a checkpoint task.triggerCheckpointBarrier(checkpointId, checkpointTimestamp, CheckpointOptions.forCheckpointWithDefaultLocation(), false); // wait until the task has completed execution taskRun.get(); // check that no failure occurred if (task.getFailureCause() != null) { throw new Exception("Task failed", task.getFailureCause()); } // check that we have entered the finished state assertEquals(ExecutionState.FINISHED, task.getExecutionState()); }
Example #25
Source File: DummyEnvironment.java From flink with Apache License 2.0 | 4 votes |
@Override public TaskManagerRuntimeInfo getTaskManagerInfo() { return new TestingTaskManagerRuntimeInfo(); }
Example #26
Source File: TestTaskContext.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public TestTaskContext(long memoryInBytes) { this.memoryManager = new MemoryManager(memoryInBytes, 1, 32 * 1024, MemoryType.HEAP, true); this.taskManageInfo = new TestingTaskManagerRuntimeInfo(); }
Example #27
Source File: SynchronousCheckpointITCase.java From flink with Apache License 2.0 | 4 votes |
private Task createTask(Class<? extends AbstractInvokable> invokableClass) throws Exception { ResultPartitionConsumableNotifier consumableNotifier = new NoOpResultPartitionConsumableNotifier(); PartitionProducerStateChecker partitionProducerStateChecker = mock(PartitionProducerStateChecker.class); Executor executor = mock(Executor.class); ShuffleEnvironment<?, ?> shuffleEnvironment = new NettyShuffleEnvironmentBuilder().build(); TaskMetricGroup taskMetricGroup = UnregisteredMetricGroups.createUnregisteredTaskMetricGroup(); JobInformation jobInformation = new JobInformation( new JobID(), "Job Name", new SerializedValue<>(new ExecutionConfig()), new Configuration(), Collections.emptyList(), Collections.emptyList()); TaskInformation taskInformation = new TaskInformation( new JobVertexID(), "Test Task", 1, 1, invokableClass.getName(), new Configuration()); return new Task( jobInformation, taskInformation, new ExecutionAttemptID(), new AllocationID(), 0, 0, Collections.<ResultPartitionDeploymentDescriptor>emptyList(), Collections.<InputGateDeploymentDescriptor>emptyList(), 0, mock(MemoryManager.class), mock(IOManager.class), shuffleEnvironment, new KvStateService(new KvStateRegistry(), null, null), mock(BroadcastVariableManager.class), new TaskEventDispatcher(), ExternalResourceInfoProvider.NO_EXTERNAL_RESOURCES, new TestTaskStateManager(), mock(TaskManagerActions.class), mock(InputSplitProvider.class), mock(CheckpointResponder.class), new NoOpTaskOperatorEventGateway(), new TestGlobalAggregateManager(), TestingClassLoaderLease.newBuilder().build(), mock(FileCache.class), new TestingTaskManagerRuntimeInfo(), taskMetricGroup, consumableNotifier, partitionProducerStateChecker, executor); }
Example #28
Source File: TaskCheckpointingBehaviourTest.java From flink with Apache License 2.0 | 4 votes |
private static Task createTask( StreamOperator<?> op, StateBackend backend, CheckpointResponder checkpointResponder) throws IOException { Configuration taskConfig = new Configuration(); StreamConfig cfg = new StreamConfig(taskConfig); cfg.setStreamOperator(op); cfg.setOperatorID(new OperatorID()); cfg.setStateBackend(backend); ExecutionConfig executionConfig = new ExecutionConfig(); JobInformation jobInformation = new JobInformation( new JobID(), "test job name", new SerializedValue<>(executionConfig), new Configuration(), Collections.emptyList(), Collections.emptyList()); TaskInformation taskInformation = new TaskInformation( new JobVertexID(), "test task name", 1, 11, TestStreamTask.class.getName(), taskConfig); ShuffleEnvironment<?, ?> shuffleEnvironment = new NettyShuffleEnvironmentBuilder().build(); return new Task( jobInformation, taskInformation, new ExecutionAttemptID(), new AllocationID(), 0, 0, Collections.<ResultPartitionDeploymentDescriptor>emptyList(), Collections.<InputGateDeploymentDescriptor>emptyList(), 0, mock(MemoryManager.class), mock(IOManager.class), shuffleEnvironment, new KvStateService(new KvStateRegistry(), null, null), mock(BroadcastVariableManager.class), new TaskEventDispatcher(), ExternalResourceInfoProvider.NO_EXTERNAL_RESOURCES, new TestTaskStateManager(), mock(TaskManagerActions.class), mock(InputSplitProvider.class), checkpointResponder, new NoOpTaskOperatorEventGateway(), new TestGlobalAggregateManager(), TestingClassLoaderLease.newBuilder().build(), new FileCache(new String[] { EnvironmentInformation.getTemporaryFileDirectory() }, VoidPermanentBlobService.INSTANCE), new TestingTaskManagerRuntimeInfo(), UnregisteredMetricGroups.createUnregisteredTaskMetricGroup(), new NoOpResultPartitionConsumableNotifier(), mock(PartitionProducerStateChecker.class), Executors.directExecutor()); }
Example #29
Source File: TaskAsyncCallTest.java From flink with Apache License 2.0 | 4 votes |
private Task createTask(Class<? extends AbstractInvokable> invokableClass) throws Exception { final TestingClassLoaderLease classLoaderHandle = TestingClassLoaderLease.newBuilder() .setGetOrResolveClassLoaderFunction((permanentBlobKeys, urls) -> new TestUserCodeClassLoader()) .build(); ResultPartitionConsumableNotifier consumableNotifier = new NoOpResultPartitionConsumableNotifier(); PartitionProducerStateChecker partitionProducerStateChecker = mock(PartitionProducerStateChecker.class); Executor executor = mock(Executor.class); TaskMetricGroup taskMetricGroup = UnregisteredMetricGroups.createUnregisteredTaskMetricGroup(); JobInformation jobInformation = new JobInformation( new JobID(), "Job Name", new SerializedValue<>(new ExecutionConfig()), new Configuration(), Collections.emptyList(), Collections.emptyList()); TaskInformation taskInformation = new TaskInformation( new JobVertexID(), "Test Task", 1, 1, invokableClass.getName(), new Configuration()); return new Task( jobInformation, taskInformation, new ExecutionAttemptID(), new AllocationID(), 0, 0, Collections.<ResultPartitionDeploymentDescriptor>emptyList(), Collections.<InputGateDeploymentDescriptor>emptyList(), 0, mock(MemoryManager.class), mock(IOManager.class), shuffleEnvironment, new KvStateService(new KvStateRegistry(), null, null), mock(BroadcastVariableManager.class), new TaskEventDispatcher(), ExternalResourceInfoProvider.NO_EXTERNAL_RESOURCES, new TestTaskStateManager(), mock(TaskManagerActions.class), mock(InputSplitProvider.class), mock(CheckpointResponder.class), new NoOpTaskOperatorEventGateway(), new TestGlobalAggregateManager(), classLoaderHandle, mock(FileCache.class), new TestingTaskManagerRuntimeInfo(), taskMetricGroup, consumableNotifier, partitionProducerStateChecker, executor); }
Example #30
Source File: TestTaskBuilder.java From flink with Apache License 2.0 | 4 votes |
public Task build() throws Exception { final JobVertexID jobVertexId = new JobVertexID(); final SerializedValue<ExecutionConfig> serializedExecutionConfig = new SerializedValue<>(executionConfig); final JobInformation jobInformation = new JobInformation( jobId, "Test Job", serializedExecutionConfig, new Configuration(), requiredJarFileBlobKeys, Collections.emptyList()); final TaskInformation taskInformation = new TaskInformation( jobVertexId, "Test Task", 1, 1, invokable.getName(), taskConfig); final TaskMetricGroup taskMetricGroup = UnregisteredMetricGroups.createUnregisteredTaskMetricGroup(); return new Task( jobInformation, taskInformation, executionAttemptId, allocationID, 0, 0, resultPartitions, inputGates, 0, MemoryManagerBuilder.newBuilder().setMemorySize(1024 * 1024).build(), mock(IOManager.class), shuffleEnvironment, kvStateService, new BroadcastVariableManager(), new TaskEventDispatcher(), externalResourceInfoProvider, new TestTaskStateManager(), taskManagerActions, new MockInputSplitProvider(), new TestCheckpointResponder(), new NoOpTaskOperatorEventGateway(), new TestGlobalAggregateManager(), classLoaderHandle, mock(FileCache.class), new TestingTaskManagerRuntimeInfo(taskManagerConfig), taskMetricGroup, consumableNotifier, partitionProducerStateChecker, executor); }