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<JobID>
getJobIds()
Get all job ids of submitted job graphs to the submitted job graph store.CompletableFuture<Void>
globalCleanupAsync(JobID jobId, Executor executor)
globalCleanupAsync
is expected to be called from the main thread.CompletableFuture<Void>
localCleanupAsync(JobID jobId, Executor executor)
Releases the locks on the specifiedJobGraph
.void
onAddedJobGraph(JobID jobId)
Callback forJobGraph
instances added by a differentJobGraphStore
instance.void
onRemovedJobGraph(JobID jobId)
Callback forJobGraph
instances removed by a differentJobGraphStore
instance.void
putJobGraph(JobGraph jobGraph)
Adds theJobGraph
instance.void
putJobResourceRequirements(JobID jobId, JobResourceRequirements jobResourceRequirements)
Persistjob resource requirements
for the given job.JobGraph
recoverJobGraph(JobID jobId)
void
start(JobGraphStore.JobGraphListener jobGraphListener)
Starts theJobGraphStore
service.void
stop()
Stops theJobGraphStore
service.
-
-
-
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:JobGraphStore
Starts theJobGraphStore
service.- Specified by:
start
in interfaceJobGraphStore
- Throws:
Exception
-
stop
public void stop() throws Exception
Description copied from interface:JobGraphStore
Stops theJobGraphStore
service.- Specified by:
stop
in interfaceJobGraphStore
- Throws:
Exception
-
recoverJobGraph
@Nullable public JobGraph recoverJobGraph(JobID jobId) throws Exception
Description copied from interface:JobGraphStore
- Specified by:
recoverJobGraph
in interfaceJobGraphStore
- Throws:
Exception
-
putJobGraph
public void putJobGraph(JobGraph jobGraph) throws Exception
Description copied from interface:JobGraphWriter
- Specified by:
putJobGraph
in interfaceJobGraphWriter
- Throws:
Exception
-
putJobResourceRequirements
public void putJobResourceRequirements(JobID jobId, JobResourceRequirements jobResourceRequirements) throws Exception
Description copied from interface:JobGraphWriter
Persistjob resource requirements
for the given job.- Specified by:
putJobResourceRequirements
in 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(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 interfaceGloballyCleanableResource
- Specified by:
globalCleanupAsync
in interfaceJobGraphWriter
- 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(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:
localCleanupAsync
in interfaceJobGraphWriter
- 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<JobID> getJobIds() throws Exception
Description copied from interface:JobGraphStore
Get all job ids of submitted job graphs to the submitted job graph store.- Specified by:
getJobIds
in interfaceJobGraphStore
- Returns:
- Collection of submitted job ids
- Throws:
Exception
- if the operation fails
-
onAddedJobGraph
public void onAddedJobGraph(JobID jobId)
Description copied from interface:JobGraphStore.JobGraphListener
Callback forJobGraph
instances added by a differentJobGraphStore
instance.Important: It is possible to get false positives and be notified about a job graph, which was added by this instance.
- Specified by:
onAddedJobGraph
in interfaceJobGraphStore.JobGraphListener
- Parameters:
jobId
- TheJobID
of the added job graph
-
onRemovedJobGraph
public void onRemovedJobGraph(JobID jobId)
Description copied from interface:JobGraphStore.JobGraphListener
Callback forJobGraph
instances removed by a differentJobGraphStore
instance.- Specified by:
onRemovedJobGraph
in interfaceJobGraphStore.JobGraphListener
- Parameters:
jobId
- TheJobID
of the removed job graph
-
-