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)
globalCleanupAsync
is 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
.void
onAddedExecutionPlan(org.apache.flink.api.common.JobID jobId)
Callback forExecutionPlan
instances added by a differentExecutionPlanStore
instance.void
onRemovedExecutionPlan(org.apache.flink.api.common.JobID jobId)
Callback forExecutionPlan
instances removed by a differentExecutionPlanStore
instance.void
putExecutionPlan(ExecutionPlan executionPlan)
Adds theExecutionPlan
instance.void
putJobResourceRequirements(org.apache.flink.api.common.JobID jobId, JobResourceRequirements jobResourceRequirements)
Persistjob resource requirements
for the given job.ExecutionPlan
recoverExecutionPlan(org.apache.flink.api.common.JobID jobId)
void
start(ExecutionPlanStore.ExecutionPlanListener executionPlanListener)
Starts theExecutionPlanStore
service.void
stop()
Stops theExecutionPlanStore
service.
-
-
-
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:ExecutionPlanStore
Starts theExecutionPlanStore
service.- Specified by:
start
in interfaceExecutionPlanStore
- Throws:
Exception
-
stop
public void stop() throws Exception
Description copied from interface:ExecutionPlanStore
Stops theExecutionPlanStore
service.- Specified by:
stop
in interfaceExecutionPlanStore
- Throws:
Exception
-
recoverExecutionPlan
@Nullable public ExecutionPlan recoverExecutionPlan(org.apache.flink.api.common.JobID jobId) throws Exception
Description copied from interface:ExecutionPlanStore
- Specified by:
recoverExecutionPlan
in interfaceExecutionPlanStore
- Throws:
Exception
-
putExecutionPlan
public void putExecutionPlan(ExecutionPlan executionPlan) throws Exception
Description copied from interface:ExecutionPlanWriter
Adds theExecutionPlan
instance.If a execution plan with the same
JobID
exists, it is replaced.- Specified by:
putExecutionPlan
in interfaceExecutionPlanWriter
- Throws:
Exception
-
putJobResourceRequirements
public void putJobResourceRequirements(org.apache.flink.api.common.JobID jobId, JobResourceRequirements jobResourceRequirements) throws Exception
Description copied from interface:ExecutionPlanWriter
Persistjob resource requirements
for the given job.- Specified by:
putJobResourceRequirements
in 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:GloballyCleanableResource
globalCleanupAsync
is expected to be called from the main thread. Heavy IO tasks should be outsourced into the passedcleanupExecutor
. Thread-safety must be ensured.- Specified by:
globalCleanupAsync
in interfaceExecutionPlanWriter
- Specified by:
globalCleanupAsync
in interfaceGloballyCleanableResource
- Parameters:
jobId
- TheJobID
of 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:
localCleanupAsync
in interfaceExecutionPlanWriter
- Specified by:
localCleanupAsync
in 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:ExecutionPlanStore
Get all job ids of submitted job graphs to the submitted execution plan store.- Specified by:
getJobIds
in 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.ExecutionPlanListener
Callback forExecutionPlan
instances added by a differentExecutionPlanStore
instance.Important: It is possible to get false positives and be notified about a job graph, which was added by this instance.
- Specified by:
onAddedExecutionPlan
in interfaceExecutionPlanStore.ExecutionPlanListener
- Parameters:
jobId
- TheJobID
of the added job graph
-
onRemovedExecutionPlan
public void onRemovedExecutionPlan(org.apache.flink.api.common.JobID jobId)
Description copied from interface:ExecutionPlanStore.ExecutionPlanListener
Callback forExecutionPlan
instances removed by a differentExecutionPlanStore
instance.- Specified by:
onRemovedExecutionPlan
in interfaceExecutionPlanStore.ExecutionPlanListener
- Parameters:
jobId
- TheJobID
of the removed job graph
-
-