Search in sources :

Example 1 with DefaultJobGraphStore

use of org.apache.flink.runtime.jobmanager.DefaultJobGraphStore in project flink by apache.

the class ZooKeeperUtils method createJobGraphs.

/**
 * Creates a {@link DefaultJobGraphStore} instance with {@link ZooKeeperStateHandleStore},
 * {@link ZooKeeperJobGraphStoreWatcher} and {@link ZooKeeperJobGraphStoreUtil}.
 *
 * @param client The {@link CuratorFramework} ZooKeeper client to use
 * @param configuration {@link Configuration} object
 * @return {@link DefaultJobGraphStore} instance
 * @throws Exception if the submitted job graph store cannot be created
 */
public static JobGraphStore createJobGraphs(CuratorFramework client, Configuration configuration) throws Exception {
    checkNotNull(configuration, "Configuration");
    RetrievableStateStorageHelper<JobGraph> stateStorage = createFileSystemStateStorage(configuration, HA_STORAGE_SUBMITTED_JOBGRAPH_PREFIX);
    // ZooKeeper submitted jobs root dir
    String zooKeeperJobsPath = configuration.getString(HighAvailabilityOptions.HA_ZOOKEEPER_JOBGRAPHS_PATH);
    // Ensure that the job graphs path exists
    client.newNamespaceAwareEnsurePath(zooKeeperJobsPath).ensure(client.getZookeeperClient());
    // All operations will have the path as root
    CuratorFramework facade = client.usingNamespace(client.getNamespace() + zooKeeperJobsPath);
    final String zooKeeperFullJobsPath = client.getNamespace() + zooKeeperJobsPath;
    final ZooKeeperStateHandleStore<JobGraph> zooKeeperStateHandleStore = new ZooKeeperStateHandleStore<>(facade, stateStorage);
    final PathChildrenCache pathCache = new PathChildrenCache(facade, "/", false);
    return new DefaultJobGraphStore<>(zooKeeperStateHandleStore, new ZooKeeperJobGraphStoreWatcher(pathCache), ZooKeeperJobGraphStoreUtil.INSTANCE);
}
Also used : ZooKeeperJobGraphStoreWatcher(org.apache.flink.runtime.jobmanager.ZooKeeperJobGraphStoreWatcher) JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) CuratorFramework(org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework) ZooKeeperStateHandleStore(org.apache.flink.runtime.zookeeper.ZooKeeperStateHandleStore) PathChildrenCache(org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.cache.PathChildrenCache) DefaultJobGraphStore(org.apache.flink.runtime.jobmanager.DefaultJobGraphStore)

Aggregations

JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)1 DefaultJobGraphStore (org.apache.flink.runtime.jobmanager.DefaultJobGraphStore)1 ZooKeeperJobGraphStoreWatcher (org.apache.flink.runtime.jobmanager.ZooKeeperJobGraphStoreWatcher)1 ZooKeeperStateHandleStore (org.apache.flink.runtime.zookeeper.ZooKeeperStateHandleStore)1 CuratorFramework (org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework)1 PathChildrenCache (org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.cache.PathChildrenCache)1