org.apache.flink.runtime.taskmanager.CheckpointResponder Java Examples
The following examples show how to use
org.apache.flink.runtime.taskmanager.CheckpointResponder.
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: JobManagerConnection.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
public JobManagerConnection( JobID jobID, ResourceID resourceID, JobMasterGateway jobMasterGateway, TaskManagerActions taskManagerActions, CheckpointResponder checkpointResponder, GlobalAggregateManager aggregateManager, LibraryCacheManager libraryCacheManager, ResultPartitionConsumableNotifier resultPartitionConsumableNotifier, PartitionProducerStateChecker partitionStateChecker) { this.jobID = Preconditions.checkNotNull(jobID); this.resourceID = Preconditions.checkNotNull(resourceID); this.jobMasterGateway = Preconditions.checkNotNull(jobMasterGateway); this.taskManagerActions = Preconditions.checkNotNull(taskManagerActions); this.checkpointResponder = Preconditions.checkNotNull(checkpointResponder); this.aggregateManager = Preconditions.checkNotNull(aggregateManager); this.libraryCacheManager = Preconditions.checkNotNull(libraryCacheManager); this.resultPartitionConsumableNotifier = Preconditions.checkNotNull(resultPartitionConsumableNotifier); this.partitionStateChecker = Preconditions.checkNotNull(partitionStateChecker); }
Example #2
Source File: TaskCheckpointingBehaviourTest.java From flink with Apache License 2.0 | 6 votes |
@Test public void testBlockingNonInterruptibleCheckpoint() throws Exception { StateBackend lockingStateBackend = new BackendForTestStream(LockingOutputStream::new); Task task = createTask(new TestOperator(), lockingStateBackend, mock(CheckpointResponder.class)); // start the task and wait until it is in "restore" task.startTaskThread(); IN_CHECKPOINT_LATCH.await(); // cancel the task and wait. unless cancellation properly closes // the streams, this will never terminate task.cancelExecution(); task.getExecutingThread().join(); assertEquals(ExecutionState.CANCELED, task.getExecutionState()); assertNull(task.getFailureCause()); }
Example #3
Source File: DefaultJobTable.java From flink with Apache License 2.0 | 6 votes |
@Override public JobTable.Connection connect( ResourceID resourceId, JobMasterGateway jobMasterGateway, TaskManagerActions taskManagerActions, CheckpointResponder checkpointResponder, GlobalAggregateManager aggregateManager, ResultPartitionConsumableNotifier resultPartitionConsumableNotifier, PartitionProducerStateChecker partitionStateChecker) { verifyJobIsNotClosed(); Preconditions.checkState(connection == null); connection = new EstablishedConnection( resourceId, jobMasterGateway, taskManagerActions, checkpointResponder, aggregateManager, resultPartitionConsumableNotifier, partitionStateChecker); resourceIdJobIdIndex.put(resourceId, jobId); return this; }
Example #4
Source File: DefaultJobTable.java From flink with Apache License 2.0 | 6 votes |
private EstablishedConnection( ResourceID resourceID, JobMasterGateway jobMasterGateway, TaskManagerActions taskManagerActions, CheckpointResponder checkpointResponder, GlobalAggregateManager globalAggregateManager, ResultPartitionConsumableNotifier resultPartitionConsumableNotifier, PartitionProducerStateChecker partitionStateChecker) { this.resourceID = Preconditions.checkNotNull(resourceID); this.jobMasterGateway = Preconditions.checkNotNull(jobMasterGateway); this.taskManagerActions = Preconditions.checkNotNull(taskManagerActions); this.checkpointResponder = Preconditions.checkNotNull(checkpointResponder); this.globalAggregateManager = Preconditions.checkNotNull(globalAggregateManager); this.resultPartitionConsumableNotifier = Preconditions.checkNotNull(resultPartitionConsumableNotifier); this.partitionStateChecker = Preconditions.checkNotNull(partitionStateChecker); }
Example #5
Source File: TaskSubmissionTestEnvironment.java From flink with Apache License 2.0 | 6 votes |
static JobManagerConnection createJobManagerConnection(JobID jobId, JobMasterGateway jobMasterGateway, RpcService testingRpcService, TaskManagerActions taskManagerActions, Time timeout) { final LibraryCacheManager libraryCacheManager = mock(LibraryCacheManager.class); when(libraryCacheManager.getClassLoader(any(JobID.class))).thenReturn(ClassLoader.getSystemClassLoader()); final PartitionProducerStateChecker partitionProducerStateChecker = mock(PartitionProducerStateChecker.class); when(partitionProducerStateChecker.requestPartitionProducerState(any(), any(), any())) .thenReturn(CompletableFuture.completedFuture(ExecutionState.RUNNING)); return new JobManagerConnection( jobId, ResourceID.generate(), jobMasterGateway, taskManagerActions, mock(CheckpointResponder.class), new TestGlobalAggregateManager(), libraryCacheManager, new RpcResultPartitionConsumableNotifier(jobMasterGateway, testingRpcService.getExecutor(), timeout), partitionProducerStateChecker); }
Example #6
Source File: JobManagerConnection.java From flink with Apache License 2.0 | 6 votes |
public JobManagerConnection( JobID jobID, ResourceID resourceID, JobMasterGateway jobMasterGateway, TaskManagerActions taskManagerActions, CheckpointResponder checkpointResponder, GlobalAggregateManager aggregateManager, LibraryCacheManager libraryCacheManager, ResultPartitionConsumableNotifier resultPartitionConsumableNotifier, PartitionProducerStateChecker partitionStateChecker) { this.jobID = Preconditions.checkNotNull(jobID); this.resourceID = Preconditions.checkNotNull(resourceID); this.jobMasterGateway = Preconditions.checkNotNull(jobMasterGateway); this.taskManagerActions = Preconditions.checkNotNull(taskManagerActions); this.checkpointResponder = Preconditions.checkNotNull(checkpointResponder); this.aggregateManager = Preconditions.checkNotNull(aggregateManager); this.libraryCacheManager = Preconditions.checkNotNull(libraryCacheManager); this.resultPartitionConsumableNotifier = Preconditions.checkNotNull(resultPartitionConsumableNotifier); this.partitionStateChecker = Preconditions.checkNotNull(partitionStateChecker); }
Example #7
Source File: TaskCheckpointingBehaviourTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Test public void testBlockingNonInterruptibleCheckpoint() throws Exception { StateBackend lockingStateBackend = new BackendForTestStream(LockingOutputStream::new); Task task = createTask(new TestOperator(), lockingStateBackend, mock(CheckpointResponder.class), true); // start the task and wait until it is in "restore" task.startTaskThread(); IN_CHECKPOINT_LATCH.await(); // cancel the task and wait. unless cancellation properly closes // the streams, this will never terminate task.cancelExecution(); task.getExecutingThread().join(); assertEquals(ExecutionState.CANCELED, task.getExecutionState()); assertNull(task.getFailureCause()); }
Example #8
Source File: TaskCheckpointingBehaviourTest.java From flink with Apache License 2.0 | 6 votes |
@Test public void testBlockingNonInterruptibleCheckpoint() throws Exception { StateBackend lockingStateBackend = new BackendForTestStream(LockingOutputStream::new); Task task = createTask(new TestOperator(), lockingStateBackend, mock(CheckpointResponder.class)); // start the task and wait until it is in "restore" task.startTaskThread(); IN_CHECKPOINT_LATCH.await(); // cancel the task and wait. unless cancellation properly closes // the streams, this will never terminate task.cancelExecution(); task.getExecutingThread().join(); assertEquals(ExecutionState.CANCELED, task.getExecutionState()); assertNull(task.getFailureCause()); }
Example #9
Source File: TaskExecutor.java From flink with Apache License 2.0 | 5 votes |
private JobManagerConnection associateWithJobManager( JobID jobID, ResourceID resourceID, JobMasterGateway jobMasterGateway) { checkNotNull(jobID); checkNotNull(resourceID); checkNotNull(jobMasterGateway); TaskManagerActions taskManagerActions = new TaskManagerActionsImpl(jobMasterGateway); CheckpointResponder checkpointResponder = new RpcCheckpointResponder(jobMasterGateway); GlobalAggregateManager aggregateManager = new RpcGlobalAggregateManager(jobMasterGateway); final LibraryCacheManager libraryCacheManager = new BlobLibraryCacheManager( blobCacheService.getPermanentBlobService(), taskManagerConfiguration.getClassLoaderResolveOrder(), taskManagerConfiguration.getAlwaysParentFirstLoaderPatterns()); ResultPartitionConsumableNotifier resultPartitionConsumableNotifier = new RpcResultPartitionConsumableNotifier( jobMasterGateway, getRpcService().getExecutor(), taskManagerConfiguration.getTimeout()); PartitionProducerStateChecker partitionStateChecker = new RpcPartitionStateChecker(jobMasterGateway); registerQueryableState(jobID, jobMasterGateway); return new JobManagerConnection( jobID, resourceID, jobMasterGateway, taskManagerActions, checkpointResponder, aggregateManager, libraryCacheManager, resultPartitionConsumableNotifier, partitionStateChecker); }
Example #10
Source File: TaskStateManagerImpl.java From flink with Apache License 2.0 | 5 votes |
public TaskStateManagerImpl( @Nonnull JobID jobId, @Nonnull ExecutionAttemptID executionAttemptID, @Nonnull TaskLocalStateStore localStateStore, @Nullable JobManagerTaskRestore jobManagerTaskRestore, @Nonnull CheckpointResponder checkpointResponder) { this( jobId, executionAttemptID, localStateStore, jobManagerTaskRestore, checkpointResponder, new ChannelStateReaderImpl(jobManagerTaskRestore == null ? new TaskStateSnapshot() : jobManagerTaskRestore.getTaskStateSnapshot()) ); }
Example #11
Source File: TaskStateManagerImpl.java From flink with Apache License 2.0 | 5 votes |
public TaskStateManagerImpl( @Nonnull JobID jobId, @Nonnull ExecutionAttemptID executionAttemptID, @Nonnull TaskLocalStateStore localStateStore, @Nullable JobManagerTaskRestore jobManagerTaskRestore, @Nonnull CheckpointResponder checkpointResponder, @Nonnull ChannelStateReader channelStateReader) { this.jobId = jobId; this.localStateStore = localStateStore; this.jobManagerTaskRestore = jobManagerTaskRestore; this.executionAttemptID = executionAttemptID; this.checkpointResponder = checkpointResponder; this.channelStateReader = channelStateReader; }
Example #12
Source File: TestTaskStateManager.java From flink with Apache License 2.0 | 5 votes |
public TestTaskStateManager( JobID jobId, ExecutionAttemptID executionAttemptID, CheckpointResponder checkpointResponder, LocalRecoveryConfig localRecoveryConfig) { this.jobId = jobId; this.executionAttemptID = executionAttemptID; this.checkpointResponder = checkpointResponder; this.localRecoveryDirectoryProvider = localRecoveryConfig; this.jobManagerTaskStateSnapshotsByCheckpointId = new HashMap<>(); this.taskManagerTaskStateSnapshotsByCheckpointId = new HashMap<>(); this.reportedCheckpointId = -1L; }
Example #13
Source File: TestTaskStateManager.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public TestTaskStateManager( JobID jobId, ExecutionAttemptID executionAttemptID, CheckpointResponder checkpointResponder, LocalRecoveryConfig localRecoveryConfig) { this.jobId = jobId; this.executionAttemptID = executionAttemptID; this.checkpointResponder = checkpointResponder; this.localRecoveryDirectoryProvider = localRecoveryConfig; this.jobManagerTaskStateSnapshotsByCheckpointId = new HashMap<>(); this.taskManagerTaskStateSnapshotsByCheckpointId = new HashMap<>(); this.reportedCheckpointId = -1L; }
Example #14
Source File: TestTaskStateManager.java From flink with Apache License 2.0 | 5 votes |
public TestTaskStateManager( JobID jobId, ExecutionAttemptID executionAttemptID, CheckpointResponder checkpointResponder, LocalRecoveryConfig localRecoveryConfig) { this.jobId = jobId; this.executionAttemptID = executionAttemptID; this.checkpointResponder = checkpointResponder; this.localRecoveryDirectoryProvider = localRecoveryConfig; this.jobManagerTaskStateSnapshotsByCheckpointId = new HashMap<>(); this.taskManagerTaskStateSnapshotsByCheckpointId = new HashMap<>(); this.reportedCheckpointId = -1L; this.notifiedCompletedCheckpointId = -1L; this.notifiedAbortedCheckpointId = -1L; }
Example #15
Source File: TaskStateManagerImpl.java From flink with Apache License 2.0 | 5 votes |
public TaskStateManagerImpl( @Nonnull JobID jobId, @Nonnull ExecutionAttemptID executionAttemptID, @Nonnull TaskLocalStateStore localStateStore, @Nullable JobManagerTaskRestore jobManagerTaskRestore, @Nonnull CheckpointResponder checkpointResponder) { this.jobId = jobId; this.localStateStore = localStateStore; this.jobManagerTaskRestore = jobManagerTaskRestore; this.executionAttemptID = executionAttemptID; this.checkpointResponder = checkpointResponder; }
Example #16
Source File: TaskStateManagerImplTest.java From flink with Apache License 2.0 | 5 votes |
public static TaskStateManager taskStateManager( JobID jobID, ExecutionAttemptID executionAttemptID, CheckpointResponder checkpointResponderMock, JobManagerTaskRestore jobManagerTaskRestore, TaskLocalStateStore localStateStore) { return new TaskStateManagerImpl( jobID, executionAttemptID, localStateStore, jobManagerTaskRestore, checkpointResponderMock); }
Example #17
Source File: TaskStateManagerImplTest.java From flink with Apache License 2.0 | 5 votes |
public static TaskStateManager taskStateManager( JobID jobID, ExecutionAttemptID executionAttemptID, CheckpointResponder checkpointResponderMock, JobManagerTaskRestore jobManagerTaskRestore, TaskLocalStateStore localStateStore) { return new TaskStateManagerImpl( jobID, executionAttemptID, localStateStore, jobManagerTaskRestore, checkpointResponderMock); }
Example #18
Source File: TaskStateManagerImpl.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public TaskStateManagerImpl( @Nonnull JobID jobId, @Nonnull ExecutionAttemptID executionAttemptID, @Nonnull TaskLocalStateStore localStateStore, @Nullable JobManagerTaskRestore jobManagerTaskRestore, @Nonnull CheckpointResponder checkpointResponder) { this.jobId = jobId; this.localStateStore = localStateStore; this.jobManagerTaskRestore = jobManagerTaskRestore; this.executionAttemptID = executionAttemptID; this.checkpointResponder = checkpointResponder; }
Example #19
Source File: TaskExecutor.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private JobManagerConnection associateWithJobManager( JobID jobID, ResourceID resourceID, JobMasterGateway jobMasterGateway) { checkNotNull(jobID); checkNotNull(resourceID); checkNotNull(jobMasterGateway); TaskManagerActions taskManagerActions = new TaskManagerActionsImpl(jobMasterGateway); CheckpointResponder checkpointResponder = new RpcCheckpointResponder(jobMasterGateway); GlobalAggregateManager aggregateManager = new RpcGlobalAggregateManager(jobMasterGateway); final LibraryCacheManager libraryCacheManager = new BlobLibraryCacheManager( blobCacheService.getPermanentBlobService(), taskManagerConfiguration.getClassLoaderResolveOrder(), taskManagerConfiguration.getAlwaysParentFirstLoaderPatterns()); ResultPartitionConsumableNotifier resultPartitionConsumableNotifier = new RpcResultPartitionConsumableNotifier( jobMasterGateway, getRpcService().getExecutor(), taskManagerConfiguration.getTimeout()); PartitionProducerStateChecker partitionStateChecker = new RpcPartitionStateChecker(jobMasterGateway); registerQueryableState(jobID, jobMasterGateway); return new JobManagerConnection( jobID, resourceID, jobMasterGateway, taskManagerActions, checkpointResponder, aggregateManager, libraryCacheManager, resultPartitionConsumableNotifier, partitionStateChecker); }
Example #20
Source File: TaskExecutor.java From flink with Apache License 2.0 | 5 votes |
private JobTable.Connection associateWithJobManager( JobTable.Job job, ResourceID resourceID, JobMasterGateway jobMasterGateway) { checkNotNull(resourceID); checkNotNull(jobMasterGateway); TaskManagerActions taskManagerActions = new TaskManagerActionsImpl(jobMasterGateway); CheckpointResponder checkpointResponder = new RpcCheckpointResponder(jobMasterGateway); GlobalAggregateManager aggregateManager = new RpcGlobalAggregateManager(jobMasterGateway); ResultPartitionConsumableNotifier resultPartitionConsumableNotifier = new RpcResultPartitionConsumableNotifier( jobMasterGateway, getRpcService().getExecutor(), taskManagerConfiguration.getTimeout()); PartitionProducerStateChecker partitionStateChecker = new RpcPartitionStateChecker(jobMasterGateway); registerQueryableState(job.getJobId(), jobMasterGateway); return job.connect( resourceID, jobMasterGateway, taskManagerActions, checkpointResponder, aggregateManager, resultPartitionConsumableNotifier, partitionStateChecker); }
Example #21
Source File: TaskStateManagerImplTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public static TaskStateManager taskStateManager( JobID jobID, ExecutionAttemptID executionAttemptID, CheckpointResponder checkpointResponderMock, JobManagerTaskRestore jobManagerTaskRestore, TaskLocalStateStore localStateStore) { return new TaskStateManagerImpl( jobID, executionAttemptID, localStateStore, jobManagerTaskRestore, checkpointResponderMock); }
Example #22
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 #23
Source File: DefaultJobTable.java From flink with Apache License 2.0 | 4 votes |
public CheckpointResponder getCheckpointResponder() { return checkpointResponder; }
Example #24
Source File: DefaultJobTable.java From flink with Apache License 2.0 | 4 votes |
@Override public CheckpointResponder getCheckpointResponder() { return verifyContainsEstablishedConnection().getCheckpointResponder(); }
Example #25
Source File: TestTaskStateManager.java From flink with Apache License 2.0 | 4 votes |
public CheckpointResponder getCheckpointResponder() { return checkpointResponder; }
Example #26
Source File: TestTaskStateManager.java From flink with Apache License 2.0 | 4 votes |
public void setCheckpointResponder(CheckpointResponder checkpointResponder) { this.checkpointResponder = checkpointResponder; }
Example #27
Source File: StreamTaskTest.java From flink with Apache License 2.0 | 4 votes |
/** * FLINK-5985 * * <p>This test ensures that empty snapshots (no op/keyed stated whatsoever) will be reported as stateless tasks. This * happens by translating an empty {@link SubtaskState} into reporting 'null' to #acknowledgeCheckpoint. */ @Test public void testEmptySubtaskStateLeadsToStatelessAcknowledgment() throws Exception { // latch blocks until the async checkpoint thread acknowledges final OneShotLatch checkpointCompletedLatch = new OneShotLatch(); final List<SubtaskState> checkpointResult = new ArrayList<>(1); CheckpointResponder checkpointResponder = mock(CheckpointResponder.class); doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { SubtaskState subtaskState = invocation.getArgument(4); checkpointResult.add(subtaskState); checkpointCompletedLatch.trigger(); return null; } }).when(checkpointResponder).acknowledgeCheckpoint( any(JobID.class), any(ExecutionAttemptID.class), anyLong(), any(CheckpointMetrics.class), nullable(TaskStateSnapshot.class)); TaskStateManager taskStateManager = new TaskStateManagerImpl( new JobID(1L, 2L), new ExecutionAttemptID(1L, 2L), mock(TaskLocalStateStoreImpl.class), null, checkpointResponder); // mock the operator with empty snapshot result (all state handles are null) OneInputStreamOperator<String, String> statelessOperator = streamOperatorWithSnapshot(new OperatorSnapshotFutures()); try (MockEnvironment mockEnvironment = new MockEnvironmentBuilder() .setTaskStateManager(taskStateManager) .build()) { RunningTask<MockStreamTask> task = runTask(() -> createMockStreamTask( mockEnvironment, operatorChain(statelessOperator))); waitTaskIsRunning(task.streamTask, task.invocationFuture); task.streamTask.triggerCheckpointAsync( new CheckpointMetaData(42L, 1L), CheckpointOptions.forCheckpointWithDefaultLocation(), false); checkpointCompletedLatch.await(30, TimeUnit.SECONDS); // ensure that 'null' was acknowledged as subtask state Assert.assertNull(checkpointResult.get(0)); task.streamTask.cancel(); task.waitForTaskCompletion(true); } }
Example #28
Source File: JvmExitOnFatalErrorTest.java From flink with Apache License 2.0 | 4 votes |
public static void main(String[] args) throws Exception { System.err.println("creating task"); // we suppress process exits via errors here to not // have a test that exits accidentally due to a programming error try { final Configuration taskManagerConfig = new Configuration(); taskManagerConfig.setBoolean(TaskManagerOptions.KILL_ON_OUT_OF_MEMORY, true); final JobID jid = new JobID(); final AllocationID allocationID = new AllocationID(); final JobVertexID jobVertexId = new JobVertexID(); final ExecutionAttemptID executionAttemptID = new ExecutionAttemptID(); final AllocationID slotAllocationId = new AllocationID(); final SerializedValue<ExecutionConfig> execConfig = new SerializedValue<>(new ExecutionConfig()); final JobInformation jobInformation = new JobInformation( jid, "Test Job", execConfig, new Configuration(), Collections.emptyList(), Collections.emptyList()); final TaskInformation taskInformation = new TaskInformation( jobVertexId, "Test Task", 1, 1, OomInvokable.class.getName(), new Configuration()); final MemoryManager memoryManager = MemoryManagerBuilder.newBuilder().setMemorySize(1024 * 1024).build(); final IOManager ioManager = new IOManagerAsync(); final ShuffleEnvironment<?, ?> shuffleEnvironment = new NettyShuffleEnvironmentBuilder().build(); final Configuration copiedConf = new Configuration(taskManagerConfig); final TaskManagerRuntimeInfo tmInfo = TaskManagerConfiguration .fromConfiguration( taskManagerConfig, TaskExecutorResourceUtils.resourceSpecFromConfigForLocalExecution(copiedConf), InetAddress.getLoopbackAddress().getHostAddress()); final Executor executor = Executors.newCachedThreadPool(); final TaskLocalStateStore localStateStore = new TaskLocalStateStoreImpl( jid, allocationID, jobVertexId, 0, TestLocalRecoveryConfig.disabled(), executor); final TaskStateManager slotStateManager = new TaskStateManagerImpl( jid, executionAttemptID, localStateStore, null, mock(CheckpointResponder.class)); Task task = new Task( jobInformation, taskInformation, executionAttemptID, slotAllocationId, 0, // subtaskIndex 0, // attemptNumber Collections.<ResultPartitionDeploymentDescriptor>emptyList(), Collections.<InputGateDeploymentDescriptor>emptyList(), 0, // targetSlotNumber memoryManager, ioManager, shuffleEnvironment, new KvStateService(new KvStateRegistry(), null, null), new BroadcastVariableManager(), new TaskEventDispatcher(), ExternalResourceInfoProvider.NO_EXTERNAL_RESOURCES, slotStateManager, new NoOpTaskManagerActions(), new NoOpInputSplitProvider(), NoOpCheckpointResponder.INSTANCE, new NoOpTaskOperatorEventGateway(), new TestGlobalAggregateManager(), TestingClassLoaderLease.newBuilder().build(), new FileCache(tmInfo.getTmpDirectories(), VoidPermanentBlobService.INSTANCE), tmInfo, UnregisteredMetricGroups.createUnregisteredTaskMetricGroup(), new NoOpResultPartitionConsumableNotifier(), new NoOpPartitionProducerStateChecker(), executor); System.err.println("starting task thread"); task.startTaskThread(); } catch (Throwable t) { System.err.println("ERROR STARTING TASK"); t.printStackTrace(); } System.err.println("parking the main thread"); CommonTestUtils.blockForeverNonInterruptibly(); }
Example #29
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 #30
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); }