Class DefaultExecutionPlanStore<R extends ResourceVersion<R>>
- java.lang.Object
-
- org.apache.flink.runtime.jobmanager.DefaultExecutionPlanStore<R>
-
- All Implemented Interfaces:
GloballyCleanableResource,LocallyCleanableResource,ExecutionPlanStore,ExecutionPlanStore.ExecutionPlanListener,ExecutionPlanWriter
public class DefaultExecutionPlanStore<R extends ResourceVersion<R>> extends Object implements ExecutionPlanStore, ExecutionPlanStore.ExecutionPlanListener
Default implementation forExecutionPlanStore. Combined with differentStateHandleStore, we could persist the execution plans to various distributed storage. Also combined with differentExecutionPlanStoreWatcher, we could get all the changes on the execution plan store and do the response.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.jobmanager.ExecutionPlanStore
ExecutionPlanStore.ExecutionPlanListener
-
-
Constructor Summary
Constructors Constructor Description DefaultExecutionPlanStore(StateHandleStore<ExecutionPlan,R> stateHandleStore, ExecutionPlanStoreWatcher executionPlanStoreWatcher, ExecutionPlanStoreUtil executionPlanStoreUtil)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<org.apache.flink.api.common.JobID>getJobIds()Get all job ids of submitted job graphs to the submitted execution plan store.CompletableFuture<Void>globalCleanupAsync(org.apache.flink.api.common.JobID jobId, Executor executor)globalCleanupAsyncis expected to be called from the main thread.CompletableFuture<Void>localCleanupAsync(org.apache.flink.api.common.JobID jobId, Executor executor)Releases the locks on the specifiedExecutionPlan.voidonAddedExecutionPlan(org.apache.flink.api.common.JobID jobId)Callback forExecutionPlaninstances added by a differentExecutionPlanStoreinstance.voidonRemovedExecutionPlan(org.apache.flink.api.common.JobID jobId)Callback forExecutionPlaninstances removed by a differentExecutionPlanStoreinstance.voidputExecutionPlan(ExecutionPlan executionPlan)Adds theExecutionPlaninstance.voidputJobResourceRequirements(org.apache.flink.api.common.JobID jobId, JobResourceRequirements jobResourceRequirements)Persistjob resource requirementsfor the given job.ExecutionPlanrecoverExecutionPlan(org.apache.flink.api.common.JobID jobId)voidstart(ExecutionPlanStore.ExecutionPlanListener executionPlanListener)Starts theExecutionPlanStoreservice.voidstop()Stops theExecutionPlanStoreservice.
-
-
-
Constructor Detail
-
DefaultExecutionPlanStore
public DefaultExecutionPlanStore(StateHandleStore<ExecutionPlan,R> stateHandleStore, ExecutionPlanStoreWatcher executionPlanStoreWatcher, ExecutionPlanStoreUtil executionPlanStoreUtil)
-
-
Method Detail
-
start
public void start(ExecutionPlanStore.ExecutionPlanListener executionPlanListener) throws Exception
Description copied from interface:ExecutionPlanStoreStarts theExecutionPlanStoreservice.- Specified by:
startin interfaceExecutionPlanStore- Throws:
Exception
-
stop
public void stop() throws ExceptionDescription copied from interface:ExecutionPlanStoreStops theExecutionPlanStoreservice.- Specified by:
stopin interfaceExecutionPlanStore- Throws:
Exception
-
recoverExecutionPlan
@Nullable public ExecutionPlan recoverExecutionPlan(org.apache.flink.api.common.JobID jobId) throws Exception
Description copied from interface:ExecutionPlanStore- Specified by:
recoverExecutionPlanin interfaceExecutionPlanStore- Throws:
Exception
-
putExecutionPlan
public void putExecutionPlan(ExecutionPlan executionPlan) throws Exception
Description copied from interface:ExecutionPlanWriterAdds theExecutionPlaninstance.If a execution plan with the same
JobIDexists, it is replaced.- Specified by:
putExecutionPlanin interfaceExecutionPlanWriter- Throws:
Exception
-
putJobResourceRequirements
public void putJobResourceRequirements(org.apache.flink.api.common.JobID jobId, JobResourceRequirements jobResourceRequirements) throws ExceptionDescription copied from interface:ExecutionPlanWriterPersistjob resource requirementsfor the given job.- Specified by:
putJobResourceRequirementsin interfaceExecutionPlanWriter- Parameters:
jobId- job the given requirements belong tojobResourceRequirements- requirements to persist- Throws:
Exception- in case we're not able to persist the requirements for some reason
-
globalCleanupAsync
public CompletableFuture<Void> globalCleanupAsync(org.apache.flink.api.common.JobID jobId, Executor executor)
Description copied from interface:GloballyCleanableResourceglobalCleanupAsyncis expected to be called from the main thread. Heavy IO tasks should be outsourced into the passedcleanupExecutor. Thread-safety must be ensured.- Specified by:
globalCleanupAsyncin interfaceExecutionPlanWriter- Specified by:
globalCleanupAsyncin interfaceGloballyCleanableResource- Parameters:
jobId- TheJobIDof the job for which the local data should be cleaned up.executor- The fallback executor for IO-heavy operations.- Returns:
- The cleanup result future.
-
localCleanupAsync
public CompletableFuture<Void> localCleanupAsync(org.apache.flink.api.common.JobID jobId, Executor executor)
Releases the locks on the specifiedExecutionPlan.Releasing the locks allows that another instance can delete the job from the
ExecutionPlanStore.- Specified by:
localCleanupAsyncin interfaceExecutionPlanWriter- Specified by:
localCleanupAsyncin interfaceLocallyCleanableResource- Parameters:
jobId- specifying the job to release the locks forexecutor- the executor being used for the asynchronous execution of the local cleanup.- Returns:
- The cleanup result future.
-
getJobIds
public Collection<org.apache.flink.api.common.JobID> getJobIds() throws Exception
Description copied from interface:ExecutionPlanStoreGet all job ids of submitted job graphs to the submitted execution plan store.- Specified by:
getJobIdsin interfaceExecutionPlanStore- Returns:
- Collection of submitted job ids
- Throws:
Exception- if the operation fails
-
onAddedExecutionPlan
public void onAddedExecutionPlan(org.apache.flink.api.common.JobID jobId)
Description copied from interface:ExecutionPlanStore.ExecutionPlanListenerCallback forExecutionPlaninstances added by a differentExecutionPlanStoreinstance.Important: It is possible to get false positives and be notified about a job graph, which was added by this instance.
- Specified by:
onAddedExecutionPlanin interfaceExecutionPlanStore.ExecutionPlanListener- Parameters:
jobId- TheJobIDof the added job graph
-
onRemovedExecutionPlan
public void onRemovedExecutionPlan(org.apache.flink.api.common.JobID jobId)
Description copied from interface:ExecutionPlanStore.ExecutionPlanListenerCallback forExecutionPlaninstances removed by a differentExecutionPlanStoreinstance.- Specified by:
onRemovedExecutionPlanin interfaceExecutionPlanStore.ExecutionPlanListener- Parameters:
jobId- TheJobIDof the removed job graph
-
-