public class DefaultJobGraphStore<R extends ResourceVersion<R>> extends Object implements JobGraphStore, JobGraphStore.JobGraphListener
JobGraphStore
. Combined with different StateHandleStore
, we could persist the job graphs to various distributed storage. Also combined
with different JobGraphStoreWatcher
, we could get all the changes on the job graph store
and do the response.JobGraphStore.JobGraphListener
Constructor and Description |
---|
DefaultJobGraphStore(StateHandleStore<JobGraph,R> stateHandleStore,
JobGraphStoreWatcher jobGraphStoreWatcher,
JobGraphStoreUtil jobGraphStoreUtil) |
Modifier and Type | Method and 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 specified
JobGraph . |
void |
onAddedJobGraph(JobID jobId)
Callback for
JobGraph instances added by a different JobGraphStore
instance. |
void |
onRemovedJobGraph(JobID jobId)
Callback for
JobGraph instances removed by a different JobGraphStore
instance. |
void |
putJobGraph(JobGraph jobGraph)
Adds the
JobGraph instance. |
void |
putJobResourceRequirements(JobID jobId,
JobResourceRequirements jobResourceRequirements)
Persist
job resource requirements for the given job. |
JobGraph |
recoverJobGraph(JobID jobId)
|
void |
start(JobGraphStore.JobGraphListener jobGraphListener)
Starts the
JobGraphStore service. |
void |
stop()
Stops the
JobGraphStore service. |
public DefaultJobGraphStore(StateHandleStore<JobGraph,R> stateHandleStore, JobGraphStoreWatcher jobGraphStoreWatcher, JobGraphStoreUtil jobGraphStoreUtil)
public void start(JobGraphStore.JobGraphListener jobGraphListener) throws Exception
JobGraphStore
JobGraphStore
service.start
in interface JobGraphStore
Exception
public void stop() throws Exception
JobGraphStore
JobGraphStore
service.stop
in interface JobGraphStore
Exception
@Nullable public JobGraph recoverJobGraph(JobID jobId) throws Exception
JobGraphStore
recoverJobGraph
in interface JobGraphStore
Exception
public void putJobGraph(JobGraph jobGraph) throws Exception
JobGraphWriter
putJobGraph
in interface JobGraphWriter
Exception
public void putJobResourceRequirements(JobID jobId, JobResourceRequirements jobResourceRequirements) throws Exception
JobGraphWriter
job resource requirements
for the given job.putJobResourceRequirements
in interface JobGraphWriter
jobId
- job the given requirements belong tojobResourceRequirements
- requirements to persistException
- in case we're not able to persist the requirements for some reasonpublic CompletableFuture<Void> globalCleanupAsync(JobID jobId, Executor executor)
GloballyCleanableResource
globalCleanupAsync
is expected to be called from the main thread. Heavy IO tasks
should be outsourced into the passed cleanupExecutor
. Thread-safety must be ensured.globalCleanupAsync
in interface GloballyCleanableResource
globalCleanupAsync
in interface JobGraphWriter
jobId
- The JobID
of the job for which the local data should be cleaned up.executor
- The fallback executor for IO-heavy operations.public CompletableFuture<Void> localCleanupAsync(JobID jobId, Executor executor)
JobGraph
.
Releasing the locks allows that another instance can delete the job from the JobGraphStore
.
localCleanupAsync
in interface LocallyCleanableResource
localCleanupAsync
in interface JobGraphWriter
jobId
- specifying the job to release the locks forexecutor
- the executor being used for the asynchronous execution of the local cleanup.public Collection<JobID> getJobIds() throws Exception
JobGraphStore
getJobIds
in interface JobGraphStore
Exception
- if the operation failspublic void onAddedJobGraph(JobID jobId)
JobGraphStore.JobGraphListener
JobGraph
instances added by a different JobGraphStore
instance.
Important: It is possible to get false positives and be notified about a job graph, which was added by this instance.
onAddedJobGraph
in interface JobGraphStore.JobGraphListener
jobId
- The JobID
of the added job graphpublic void onRemovedJobGraph(JobID jobId)
JobGraphStore.JobGraphListener
JobGraph
instances removed by a different JobGraphStore
instance.onRemovedJobGraph
in interface JobGraphStore.JobGraphListener
jobId
- The JobID
of the removed job graphCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.