Search in sources :

Example 1 with CheckpointConfigInfo

use of org.apache.flink.runtime.rest.messages.checkpoints.CheckpointConfigInfo in project flink by apache.

the class CheckpointConfigHandler method createCheckpointConfigInfo.

private static CheckpointConfigInfo createCheckpointConfigInfo(AccessExecutionGraph executionGraph) throws RestHandlerException {
    final CheckpointCoordinatorConfiguration checkpointCoordinatorConfiguration = executionGraph.getCheckpointCoordinatorConfiguration();
    if (checkpointCoordinatorConfiguration == null) {
        throw new RestHandlerException("Checkpointing is not enabled for this job (" + executionGraph.getJobID() + ").", HttpResponseStatus.NOT_FOUND, RestHandlerException.LoggingBehavior.IGNORE);
    } else {
        CheckpointRetentionPolicy retentionPolicy = checkpointCoordinatorConfiguration.getCheckpointRetentionPolicy();
        CheckpointConfigInfo.ExternalizedCheckpointInfo externalizedCheckpointInfo = new CheckpointConfigInfo.ExternalizedCheckpointInfo(retentionPolicy != CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION, retentionPolicy != CheckpointRetentionPolicy.RETAIN_ON_CANCELLATION);
        String stateBackendName = executionGraph.getStateBackendName().orElse(null);
        String checkpointStorageName = executionGraph.getCheckpointStorageName().orElse(null);
        return new CheckpointConfigInfo(checkpointCoordinatorConfiguration.isExactlyOnce() ? CheckpointConfigInfo.ProcessingMode.EXACTLY_ONCE : CheckpointConfigInfo.ProcessingMode.AT_LEAST_ONCE, checkpointCoordinatorConfiguration.getCheckpointInterval(), checkpointCoordinatorConfiguration.getCheckpointTimeout(), checkpointCoordinatorConfiguration.getMinPauseBetweenCheckpoints(), checkpointCoordinatorConfiguration.getMaxConcurrentCheckpoints(), externalizedCheckpointInfo, stateBackendName, checkpointStorageName, checkpointCoordinatorConfiguration.isUnalignedCheckpointsEnabled(), checkpointCoordinatorConfiguration.getTolerableCheckpointFailureNumber(), checkpointCoordinatorConfiguration.getAlignedCheckpointTimeout(), checkpointCoordinatorConfiguration.isEnableCheckpointsAfterTasksFinish());
    }
}
Also used : CheckpointCoordinatorConfiguration(org.apache.flink.runtime.jobgraph.tasks.CheckpointCoordinatorConfiguration) CheckpointConfigInfo(org.apache.flink.runtime.rest.messages.checkpoints.CheckpointConfigInfo) CheckpointRetentionPolicy(org.apache.flink.runtime.checkpoint.CheckpointRetentionPolicy) RestHandlerException(org.apache.flink.runtime.rest.handler.RestHandlerException)

Aggregations

CheckpointRetentionPolicy (org.apache.flink.runtime.checkpoint.CheckpointRetentionPolicy)1 CheckpointCoordinatorConfiguration (org.apache.flink.runtime.jobgraph.tasks.CheckpointCoordinatorConfiguration)1 RestHandlerException (org.apache.flink.runtime.rest.handler.RestHandlerException)1 CheckpointConfigInfo (org.apache.flink.runtime.rest.messages.checkpoints.CheckpointConfigInfo)1