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<org.apache.flink.api.common.JobID> |
getJobIds()
Get all job ids of submitted job graphs to the submitted job graph store.
|
static String |
getPathForJob(org.apache.flink.api.common.JobID jobId)
Returns the JobID as a String (with leading slash).
|
static org.apache.flink.api.common.JobID |
jobIdfromPath(String path)
Returns the JobID from the given path in ZooKeeper.
|
void |
putJobGraph(SubmittedJobGraph jobGraph)
Adds the
SubmittedJobGraph instance. |
SubmittedJobGraph |
recoverJobGraph(org.apache.flink.api.common.JobID jobId)
|
void |
releaseJobGraph(org.apache.flink.api.common.JobID jobId)
Releases the locks on the specified
JobGraph. |
void |
removeJobGraph(org.apache.flink.api.common.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 jobsExceptionpublic void start(SubmittedJobGraphStore.SubmittedJobGraphListener jobGraphListener) throws Exception
SubmittedJobGraphStoreSubmittedJobGraphStore service.start in interface SubmittedJobGraphStoreExceptionpublic void stop()
throws Exception
SubmittedJobGraphStoreSubmittedJobGraphStore service.stop in interface SubmittedJobGraphStoreException@Nullable public SubmittedJobGraph recoverJobGraph(org.apache.flink.api.common.JobID jobId) throws Exception
SubmittedJobGraphStorerecoverJobGraph in interface SubmittedJobGraphStoreExceptionpublic void putJobGraph(SubmittedJobGraph jobGraph) throws Exception
SubmittedJobGraphStoreSubmittedJobGraph instance.
If a job graph with the same JobID exists, it is replaced.
putJobGraph in interface SubmittedJobGraphStoreExceptionpublic void removeJobGraph(org.apache.flink.api.common.JobID jobId)
throws Exception
SubmittedJobGraphStoreSubmittedJobGraph with the given JobID if it exists.removeJobGraph in interface SubmittedJobGraphStoreExceptionpublic void releaseJobGraph(org.apache.flink.api.common.JobID jobId)
throws Exception
SubmittedJobGraphStoreJobGraph.
Releasing the locks allows that another instance can delete the job from
the SubmittedJobGraphStore.releaseJobGraph in interface SubmittedJobGraphStorejobId - specifying the job to release the locks forException - if the locks cannot be releasedpublic Collection<org.apache.flink.api.common.JobID> getJobIds() throws Exception
SubmittedJobGraphStoregetJobIds in interface SubmittedJobGraphStoreException - if the operation failspublic static String getPathForJob(org.apache.flink.api.common.JobID jobId)
public static org.apache.flink.api.common.JobID jobIdfromPath(String path)
path - in ZooKeeperCopyright © 2014–2019 The Apache Software Foundation. All rights reserved.