Class DefaultJobGraphStore<R extends ResourceVersion<R>>
- java.lang.Object
-
- org.apache.flink.runtime.jobmanager.DefaultJobGraphStore<R>
-
- All Implemented Interfaces:
GloballyCleanableResource,LocallyCleanableResource,JobGraphStore,JobGraphStore.JobGraphListener,JobGraphWriter
public class DefaultJobGraphStore<R extends ResourceVersion<R>> extends Object implements JobGraphStore, JobGraphStore.JobGraphListener
Default implementation forJobGraphStore. Combined with differentStateHandleStore, we could persist the job graphs to various distributed storage. Also combined with differentJobGraphStoreWatcher, we could get all the changes on the job graph store and do the response.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.jobmanager.JobGraphStore
JobGraphStore.JobGraphListener
-
-
Constructor Summary
Constructors Constructor Description DefaultJobGraphStore(StateHandleStore<JobGraph,R> stateHandleStore, JobGraphStoreWatcher jobGraphStoreWatcher, JobGraphStoreUtil jobGraphStoreUtil)
-
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 job graph 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 specifiedJobGraph.voidonAddedJobGraph(org.apache.flink.api.common.JobID jobId)Callback forJobGraphinstances added by a differentJobGraphStoreinstance.voidonRemovedJobGraph(org.apache.flink.api.common.JobID jobId)Callback forJobGraphinstances removed by a differentJobGraphStoreinstance.voidputJobGraph(JobGraph jobGraph)Adds theJobGraphinstance.voidputJobResourceRequirements(org.apache.flink.api.common.JobID jobId, JobResourceRequirements jobResourceRequirements)Persistjob resource requirementsfor the given job.JobGraphrecoverJobGraph(org.apache.flink.api.common.JobID jobId)voidstart(JobGraphStore.JobGraphListener jobGraphListener)Starts theJobGraphStoreservice.voidstop()Stops theJobGraphStoreservice.
-
-
-
Constructor Detail
-
DefaultJobGraphStore
public DefaultJobGraphStore(StateHandleStore<JobGraph,R> stateHandleStore, JobGraphStoreWatcher jobGraphStoreWatcher, JobGraphStoreUtil jobGraphStoreUtil)
-
-
Method Detail
-
start
public void start(JobGraphStore.JobGraphListener jobGraphListener) throws Exception
Description copied from interface:JobGraphStoreStarts theJobGraphStoreservice.- Specified by:
startin interfaceJobGraphStore- Throws:
Exception
-
stop
public void stop() throws ExceptionDescription copied from interface:JobGraphStoreStops theJobGraphStoreservice.- Specified by:
stopin interfaceJobGraphStore- Throws:
Exception
-
recoverJobGraph
@Nullable public JobGraph recoverJobGraph(org.apache.flink.api.common.JobID jobId) throws Exception
Description copied from interface:JobGraphStore- Specified by:
recoverJobGraphin interfaceJobGraphStore- Throws:
Exception
-
putJobGraph
public void putJobGraph(JobGraph jobGraph) throws Exception
Description copied from interface:JobGraphWriterAdds theJobGraphinstance.If a job graph with the same
JobIDexists, it is replaced.- Specified by:
putJobGraphin interfaceJobGraphWriter- Throws:
Exception
-
putJobResourceRequirements
public void putJobResourceRequirements(org.apache.flink.api.common.JobID jobId, JobResourceRequirements jobResourceRequirements) throws ExceptionDescription copied from interface:JobGraphWriterPersistjob resource requirementsfor the given job.- Specified by:
putJobResourceRequirementsin interfaceJobGraphWriter- 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 interfaceGloballyCleanableResource- Specified by:
globalCleanupAsyncin interfaceJobGraphWriter- 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 specifiedJobGraph.Releasing the locks allows that another instance can delete the job from the
JobGraphStore.- Specified by:
localCleanupAsyncin interfaceJobGraphWriter- 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:JobGraphStoreGet all job ids of submitted job graphs to the submitted job graph store.- Specified by:
getJobIdsin interfaceJobGraphStore- Returns:
- Collection of submitted job ids
- Throws:
Exception- if the operation fails
-
onAddedJobGraph
public void onAddedJobGraph(org.apache.flink.api.common.JobID jobId)
Description copied from interface:JobGraphStore.JobGraphListenerCallback forJobGraphinstances added by a differentJobGraphStoreinstance.Important: It is possible to get false positives and be notified about a job graph, which was added by this instance.
- Specified by:
onAddedJobGraphin interfaceJobGraphStore.JobGraphListener- Parameters:
jobId- TheJobIDof the added job graph
-
onRemovedJobGraph
public void onRemovedJobGraph(org.apache.flink.api.common.JobID jobId)
Description copied from interface:JobGraphStore.JobGraphListenerCallback forJobGraphinstances removed by a differentJobGraphStoreinstance.- Specified by:
onRemovedJobGraphin interfaceJobGraphStore.JobGraphListener- Parameters:
jobId- TheJobIDof the removed job graph
-
-