Class DefaultSpeculativeExecutionHandler
- java.lang.Object
-
- org.apache.flink.runtime.scheduler.adaptivebatch.DefaultSpeculativeExecutionHandler
-
- All Implemented Interfaces:
SpeculativeExecutionHandler
,SlowTaskDetectorListener
public class DefaultSpeculativeExecutionHandler extends Object implements SpeculativeExecutionHandler, SlowTaskDetectorListener
The default implementation ofSpeculativeExecutionHandler
.
-
-
Constructor Summary
Constructors Constructor Description DefaultSpeculativeExecutionHandler(Configuration jobMasterConfiguration, BlocklistOperations blocklistOperations, Function<ExecutionVertexID,ExecutionVertex> executionVertexRetriever, Supplier<Map<ExecutionAttemptID,Execution>> registerExecutionsSupplier, BiConsumer<List<Execution>,Collection<ExecutionVertexID>> allocateSlotsAndDeployFunction, org.slf4j.Logger log)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
handleTaskFailure(Execution failedExecution, Throwable error, BiConsumer<Execution,Throwable> handleLocalExecutionAttemptFailure)
Handles a task failure.void
init(ExecutionGraph executionGraph, ComponentMainThreadExecutor mainThreadExecutor, MetricGroup metricGroup)
Initial speculative execution handler.void
notifySlowTasks(Map<ExecutionVertexID,Collection<ExecutionAttemptID>> slowTasks)
Notify detected slow tasks.void
notifyTaskFailed(Execution execution)
Notifies that a task has failed its execution.void
notifyTaskFinished(Execution execution, Function<ExecutionVertexID,CompletableFuture<?>> cancelPendingExecutionsFunction)
Notifies that a task has finished its execution.void
resetForNewExecution(ExecutionVertexID executionVertexId)
Resets the state of the component for a new execution of a specific execution vertex.void
stopSlowTaskDetector()
Stops the slow task detector.
-
-
-
Constructor Detail
-
DefaultSpeculativeExecutionHandler
public DefaultSpeculativeExecutionHandler(Configuration jobMasterConfiguration, BlocklistOperations blocklistOperations, Function<ExecutionVertexID,ExecutionVertex> executionVertexRetriever, Supplier<Map<ExecutionAttemptID,Execution>> registerExecutionsSupplier, BiConsumer<List<Execution>,Collection<ExecutionVertexID>> allocateSlotsAndDeployFunction, org.slf4j.Logger log)
-
-
Method Detail
-
init
public void init(ExecutionGraph executionGraph, ComponentMainThreadExecutor mainThreadExecutor, MetricGroup metricGroup)
Description copied from interface:SpeculativeExecutionHandler
Initial speculative execution handler.- Specified by:
init
in interfaceSpeculativeExecutionHandler
-
stopSlowTaskDetector
public void stopSlowTaskDetector()
Description copied from interface:SpeculativeExecutionHandler
Stops the slow task detector.- Specified by:
stopSlowTaskDetector
in interfaceSpeculativeExecutionHandler
-
notifyTaskFinished
public void notifyTaskFinished(Execution execution, Function<ExecutionVertexID,CompletableFuture<?>> cancelPendingExecutionsFunction)
Description copied from interface:SpeculativeExecutionHandler
Notifies that a task has finished its execution.- Specified by:
notifyTaskFinished
in interfaceSpeculativeExecutionHandler
- Parameters:
execution
- the execution that has finishedcancelPendingExecutionsFunction
- the function to cancel pending executions
-
notifyTaskFailed
public void notifyTaskFailed(Execution execution)
Description copied from interface:SpeculativeExecutionHandler
Notifies that a task has failed its execution.- Specified by:
notifyTaskFailed
in interfaceSpeculativeExecutionHandler
- Parameters:
execution
- the execution that has failed
-
handleTaskFailure
public boolean handleTaskFailure(Execution failedExecution, @Nullable Throwable error, BiConsumer<Execution,Throwable> handleLocalExecutionAttemptFailure)
Description copied from interface:SpeculativeExecutionHandler
Handles a task failure.- Specified by:
handleTaskFailure
in interfaceSpeculativeExecutionHandler
- Parameters:
failedExecution
- the execution that failederror
- the error that caused the failure, if availablehandleLocalExecutionAttemptFailure
- a consumer that handles local execution attempt failure- Returns:
- true if the failure was handled as a local failure, false otherwise
-
notifySlowTasks
public void notifySlowTasks(Map<ExecutionVertexID,Collection<ExecutionAttemptID>> slowTasks)
Description copied from interface:SlowTaskDetectorListener
Notify detected slow tasks.- Specified by:
notifySlowTasks
in interfaceSlowTaskDetectorListener
- Parameters:
slowTasks
- the map of execution vertices and their execution attempts which are detected as slow.
-
resetForNewExecution
public void resetForNewExecution(ExecutionVertexID executionVertexId)
Description copied from interface:SpeculativeExecutionHandler
Resets the state of the component for a new execution of a specific execution vertex.- Specified by:
resetForNewExecution
in interfaceSpeculativeExecutionHandler
- Parameters:
executionVertexId
- the ID of the execution vertex to reset
-
-