Class SnapshotUtils
- java.lang.Object
-
- org.apache.flink.kubernetes.operator.utils.SnapshotUtils
-
public class SnapshotUtils extends java.lang.ObjectSavepoint utilities.
-
-
Constructor Summary
Constructors Constructor Description SnapshotUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancheckpointInProgress(org.apache.flink.kubernetes.operator.api.status.JobStatus jobStatus)static SnapshotStatusgetLastSnapshotStatus(org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,?> resource, SnapshotType snapshotType)static booleangracePeriodEnded(java.time.Duration gracePeriod, org.apache.flink.kubernetes.operator.api.status.SnapshotInfo snapshotInfo)static booleanisSnapshotTriggeringSupported(org.apache.flink.configuration.Configuration conf)static voidresetSnapshotTriggers(org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,?> resource, EventRecorder eventRecorder, io.fabric8.kubernetes.client.KubernetesClient client)static booleansavepointInProgress(org.apache.flink.kubernetes.operator.api.status.JobStatus jobStatus)protected static java.util.Optional<org.apache.flink.kubernetes.operator.api.status.SnapshotTriggerType>shouldTriggerSnapshot(org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,?> resource, org.apache.flink.configuration.Configuration conf, SnapshotType snapshotType)Checks whether a snapshot should be triggered based on the current status and spec, and if yes, returns the correctSnapshotTriggerType.static booleantriggerSnapshotIfNeeded(FlinkService flinkService, org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,?> resource, org.apache.flink.configuration.Configuration conf, SnapshotType snapshotType)Triggers any pending manual or periodic snapshots and updates the status accordingly.
-
-
-
Method Detail
-
savepointInProgress
public static boolean savepointInProgress(org.apache.flink.kubernetes.operator.api.status.JobStatus jobStatus)
-
checkpointInProgress
public static boolean checkpointInProgress(org.apache.flink.kubernetes.operator.api.status.JobStatus jobStatus)
-
getLastSnapshotStatus
@VisibleForTesting public static SnapshotStatus getLastSnapshotStatus(org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,?> resource, SnapshotType snapshotType)
-
triggerSnapshotIfNeeded
public static boolean triggerSnapshotIfNeeded(FlinkService flinkService, org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,?> resource, org.apache.flink.configuration.Configuration conf, SnapshotType snapshotType) throws java.lang.Exception
Triggers any pending manual or periodic snapshots and updates the status accordingly.- Parameters:
flinkService- TheFlinkServiceused to trigger snapshots.resource- The resource that should be snapshotted.conf- The observe config of the resource.- Returns:
- True if a snapshot was triggered.
- Throws:
java.lang.Exception- An error during snapshot triggering.
-
shouldTriggerSnapshot
@VisibleForTesting protected static java.util.Optional<org.apache.flink.kubernetes.operator.api.status.SnapshotTriggerType> shouldTriggerSnapshot(org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,?> resource, org.apache.flink.configuration.Configuration conf, SnapshotType snapshotType)Checks whether a snapshot should be triggered based on the current status and spec, and if yes, returns the correctSnapshotTriggerType.This logic is responsible for both manual and periodic snapshots triggering.
- Parameters:
resource- The resource to be snapshotted.conf- The observe configuration of the resource.snapshotType- The type of the snapshot.- Returns:
- An optional
SnapshotTriggerType.
-
isSnapshotTriggeringSupported
public static boolean isSnapshotTriggeringSupported(org.apache.flink.configuration.Configuration conf)
-
gracePeriodEnded
public static boolean gracePeriodEnded(java.time.Duration gracePeriod, org.apache.flink.kubernetes.operator.api.status.SnapshotInfo snapshotInfo)
-
resetSnapshotTriggers
public static void resetSnapshotTriggers(org.apache.flink.kubernetes.operator.api.AbstractFlinkResource<?,?> resource, EventRecorder eventRecorder, io.fabric8.kubernetes.client.KubernetesClient client)
-
-