public class ZooKeeperSubmittedJobGraphStore extends Object implements SubmittedJobGraphStore
SubmittedJobGraph
instances for JobManagers running in HighAvailabilityMode.ZOOKEEPER
.
Each job graph creates ZNode:
+----O /flink/jobgraphs/<job-id> 1 [persistent] . . . +----O /flink/jobgraphs/<job-id> N [persistent]
The root path is watched to detect concurrent modifications in corner situations where
multiple instances operate concurrently. The job manager acts as a SubmittedJobGraphListener
to react to such situations.
SubmittedJobGraphStore.SubmittedJobGraphListener
Constructor and Description |
---|
ZooKeeperSubmittedJobGraphStore(org.apache.curator.framework.CuratorFramework client,
String currentJobsPath,
RetrievableStateStorageHelper<SubmittedJobGraph> stateStorage)
Submitted job graph store backed by ZooKeeper.
|
Modifier and Type | Method and Description |
---|---|
Collection<JobID> |
getJobIds()
Get all job ids of submitted job graphs to the submitted job graph store.
|
static String |
getPathForJob(JobID jobId)
Returns the JobID as a String (with leading slash).
|
static JobID |
jobIdfromPath(String path)
Returns the JobID from the given path in ZooKeeper.
|
void |
putJobGraph(SubmittedJobGraph jobGraph)
Adds the
SubmittedJobGraph instance. |
SubmittedJobGraph |
recoverJobGraph(JobID jobId)
|
void |
releaseJobGraph(JobID jobId)
Releases the locks on the specified
JobGraph . |
void |
removeJobGraph(JobID jobId)
Removes the
SubmittedJobGraph with the given JobID if it exists. |
void |
start(SubmittedJobGraphStore.SubmittedJobGraphListener jobGraphListener)
Starts the
SubmittedJobGraphStore service. |
void |
stop()
Stops the
SubmittedJobGraphStore service. |
public ZooKeeperSubmittedJobGraphStore(org.apache.curator.framework.CuratorFramework client, String currentJobsPath, RetrievableStateStorageHelper<SubmittedJobGraph> stateStorage) throws Exception
client
- ZooKeeper clientcurrentJobsPath
- ZooKeeper path for current job graphsstateStorage
- State storage used to persist the submitted jobsException
public void start(SubmittedJobGraphStore.SubmittedJobGraphListener jobGraphListener) throws Exception
SubmittedJobGraphStore
SubmittedJobGraphStore
service.start
in interface SubmittedJobGraphStore
Exception
public void stop() throws Exception
SubmittedJobGraphStore
SubmittedJobGraphStore
service.stop
in interface SubmittedJobGraphStore
Exception
@Nullable public SubmittedJobGraph recoverJobGraph(JobID jobId) throws Exception
SubmittedJobGraphStore
recoverJobGraph
in interface SubmittedJobGraphStore
Exception
public void putJobGraph(SubmittedJobGraph jobGraph) throws Exception
SubmittedJobGraphStore
SubmittedJobGraph
instance.
If a job graph with the same JobID
exists, it is replaced.
putJobGraph
in interface SubmittedJobGraphStore
Exception
public void removeJobGraph(JobID jobId) throws Exception
SubmittedJobGraphStore
SubmittedJobGraph
with the given JobID
if it exists.removeJobGraph
in interface SubmittedJobGraphStore
Exception
public void releaseJobGraph(JobID jobId) throws Exception
SubmittedJobGraphStore
JobGraph
.
Releasing the locks allows that another instance can delete the job from
the SubmittedJobGraphStore
.releaseJobGraph
in interface SubmittedJobGraphStore
jobId
- specifying the job to release the locks forException
- if the locks cannot be releasedpublic Collection<JobID> getJobIds() throws Exception
SubmittedJobGraphStore
getJobIds
in interface SubmittedJobGraphStore
Exception
- if the operation failspublic static String getPathForJob(JobID jobId)
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.