Interface BatchJobRecoveryContext
public interface BatchJobRecoveryContext
Context for batch job recovery.
-
Method Summary
Modifier and TypeMethodDescriptionvoidTrigger job failure.Provides theExecutionGraphassociated with the job.org.apache.flink.runtime.concurrent.ComponentMainThreadExecutorProvides the main thread executor.Provides theShuffleMasterassociated with the job.getTasksNeedingRestart(ExecutionVertexID vertexId, boolean considerResultConsumable) Retrieves a set of vertices that need to be restarted.voidinitializeJobVertex(ExecutionJobVertex jobVertex, int parallelism, Map<IntermediateDataSetID, JobVertexInputInfo> jobVertexInputInfos, long createTimestamp) Initializes a given job vertex with the specified parallelism and input information.voidNotifies the recovery failed.voidonRecoveringFinished(Set<JobVertexID> jobVerticesWithUnRecoveredCoordinators) Notifies the recovery finished.voidresetVerticesInRecovering(Set<ExecutionVertexID> verticesToReset) Resets vertices specified by their IDs during recovery process.voidupdateResultPartitionBytesMetrics(Map<IntermediateResultPartitionID, ResultPartitionBytes> resultPartitionBytes) Updates the metrics related to the result partition sizes.voidupdateTopology(List<ExecutionJobVertex> newlyInitializedJobVertices) Updates the job topology with new job vertices that were initialized.
-
Method Details
-
getExecutionGraph
ExecutionGraph getExecutionGraph()Provides theExecutionGraphassociated with the job.- Returns:
- The execution graph.
-
getShuffleMaster
ShuffleMaster<?> getShuffleMaster()Provides theShuffleMasterassociated with the job.- Returns:
- The shuffle master.
-
getMainThreadExecutor
org.apache.flink.runtime.concurrent.ComponentMainThreadExecutor getMainThreadExecutor()Provides the main thread executor.- Returns:
- The main thread executor.
-
getTasksNeedingRestart
Set<ExecutionVertexID> getTasksNeedingRestart(ExecutionVertexID vertexId, boolean considerResultConsumable) Retrieves a set of vertices that need to be restarted. If result consumption is considered (`basedOnResultConsumable` is true), the set will include all downstream vertices that have finished and upstream vertices that have missed partitions. Otherwise, only include downstream finished vertices.- Parameters:
vertexId- The ID of the vertex from which to compute the restart set.considerResultConsumable- Indicates whether to consider result partition consumption while computing the vertices needing restart.- Returns:
- A set of vertex IDs that need to be restarted.
-
resetVerticesInRecovering
Resets vertices specified by their IDs during recovery process.- Parameters:
verticesToReset- The set of vertices that require resetting.- Throws:
Exception
-
updateResultPartitionBytesMetrics
void updateResultPartitionBytesMetrics(Map<IntermediateResultPartitionID, ResultPartitionBytes> resultPartitionBytes) Updates the metrics related to the result partition sizes.- Parameters:
resultPartitionBytes- Mapping of partition IDs to their respective result partition bytes.
-
initializeJobVertex
void initializeJobVertex(ExecutionJobVertex jobVertex, int parallelism, Map<IntermediateDataSetID, JobVertexInputInfo> jobVertexInputInfos, long createTimestamp) throws JobExceptionInitializes a given job vertex with the specified parallelism and input information.- Parameters:
jobVertex- The job vertex to initialize.parallelism- The parallelism to set for the job vertex.jobVertexInputInfos- The input information for the job vertex.createTimestamp- The timestamp marking the creation of the job vertex.- Throws:
JobException
-
updateTopology
Updates the job topology with new job vertices that were initialized.- Parameters:
newlyInitializedJobVertices- List of job vertices that have been initialized.
-
onRecoveringFinished
Notifies the recovery finished.- Parameters:
jobVerticesWithUnRecoveredCoordinators- A set of job vertex Ids is associated with job vertices whose operatorCoordinators did not successfully recover their state. If any execution within these job vertices needs to be restarted in the future, all other executions within the same job vertex must also be restarted to ensure the consistency and correctness of the state.
-
onRecoveringFailed
void onRecoveringFailed()Notifies the recovery failed. -
failJob
Trigger job failure.
-