Search in sources :

Example 21 with OperatorSnapshotFutures

use of org.apache.flink.streaming.api.operators.OperatorSnapshotFutures in project flink by apache.

the class AsyncCheckpointRunnableTest method testAsyncCheckpointException.

private void testAsyncCheckpointException(boolean isTaskRunning) {
    final Map<OperatorID, OperatorSnapshotFutures> snapshotsInProgress = new HashMap<>();
    snapshotsInProgress.put(new OperatorID(), new OperatorSnapshotFutures(ExceptionallyDoneFuture.of(new RuntimeException("Async Checkpoint Exception")), DoneFuture.of(SnapshotResult.empty()), DoneFuture.of(SnapshotResult.empty()), DoneFuture.of(SnapshotResult.empty()), DoneFuture.of(SnapshotResult.empty()), DoneFuture.of(SnapshotResult.empty())));
    final TestEnvironment environment = new TestEnvironment();
    final AsyncCheckpointRunnable runnable = createAsyncRunnable(snapshotsInProgress, environment, false, isTaskRunning);
    runnable.run();
    if (isTaskRunning) {
        Assert.assertSame(environment.getCause().getCheckpointFailureReason(), CheckpointFailureReason.CHECKPOINT_ASYNC_EXCEPTION);
    } else {
        Assert.assertNull(environment.getCause());
    }
}
Also used : OperatorSnapshotFutures(org.apache.flink.streaming.api.operators.OperatorSnapshotFutures) HashMap(java.util.HashMap) OperatorID(org.apache.flink.runtime.jobgraph.OperatorID)

Aggregations

OperatorSnapshotFutures (org.apache.flink.streaming.api.operators.OperatorSnapshotFutures)21 Test (org.junit.Test)12 CheckpointMetaData (org.apache.flink.runtime.checkpoint.CheckpointMetaData)9 OperatorID (org.apache.flink.runtime.jobgraph.OperatorID)6 CheckpointException (org.apache.flink.runtime.checkpoint.CheckpointException)5 MockEnvironment (org.apache.flink.runtime.operators.testutils.MockEnvironment)5 HashMap (java.util.HashMap)4 OperatorSubtaskState (org.apache.flink.runtime.checkpoint.OperatorSubtaskState)4 TaskStateSnapshot (org.apache.flink.runtime.checkpoint.TaskStateSnapshot)4 FlinkRuntimeException (org.apache.flink.util.FlinkRuntimeException)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 IOException (java.io.IOException)3 TimeoutException (java.util.concurrent.TimeoutException)3 CheckpointMetricsBuilder (org.apache.flink.runtime.checkpoint.CheckpointMetricsBuilder)3 DummyEnvironment (org.apache.flink.runtime.operators.testutils.DummyEnvironment)3 MockEnvironmentBuilder (org.apache.flink.runtime.operators.testutils.MockEnvironmentBuilder)3 AsynchronousException (org.apache.flink.runtime.taskmanager.AsynchronousException)3 Map (java.util.Map)2 ExecutionException (java.util.concurrent.ExecutionException)2 JobID (org.apache.flink.api.common.JobID)2