Github user uce commented on a diff in the pull request:
https://github.com/apache/flink/pull/1153#discussion_r41408822
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java
---
@@ -153,6 +176,143 @@ public static ZooKeeperLeaderElectionService
createLeaderElectionService(
}
/**
+ * Creates a {@link ZooKeeperSubmittedJobGraphs} instance.
+ *
+ * @param client The {@link CuratorFramework} ZooKeeper client
to use
+ * @param configuration {@link Configuration} object
+ * @return {@link ZooKeeperSubmittedJobGraphs} instance
+ */
+ public static ZooKeeperSubmittedJobGraphs createSubmittedJobGraphs(
+ CuratorFramework client,
+ Configuration configuration) throws Exception {
+
+ checkNotNull(configuration, "Configuration");
+
+ // State backend
+ String stateBackend = configuration.getString(
+ ConfigConstants.STATE_BACKEND,
+ ConfigConstants.DEFAULT_STATE_BACKEND);
+
+ if (!stateBackend.toLowerCase().equals("filesystem")) {
+ throw new IllegalConfigurationException(String.format(
+ "You currently have to configure the
filesystem state backend in order for " +
+ "ZooKeeper recovery to
work. Flink will use this backend to store " +
+ "meta data to recover
jobs. Please set '%s' to 'FILESYSTEM' in the " +
+ "configuration and set
the recovery path via key '%s'.",
+ ConfigConstants.STATE_BACKEND,
+
ConfigConstants.STATE_BACKEND_FS_RECOVERY_PATH));
+ }
+
+ // State backend root dir
+ String stateBackendPath = configuration.getString(
+ ConfigConstants.STATE_BACKEND_FS_RECOVERY_PATH,
+ "");
+
+ if (stateBackendPath.equals("")) {
+ throw new IllegalConfigurationException(String.format(
+ "You have to specify a path for the
file system state backend for storing " +
+ "recovery information.
Please set the configuration key '%s'.",
+
ConfigConstants.STATE_BACKEND_FS_RECOVERY_PATH));
+ }
+
+ // ZooKeeper submitted jobs root dir
+ String zooKeeperSubmittedJobsPath = configuration.getString(
+ ConfigConstants.ZOOKEEPER_JOBGRAPHS_PATH,
+
ConfigConstants.DEFAULT_ZOOKEEPER_JOBGRAPHS_PATH);
+
+ StateHandleProvider<SubmittedJobGraph> stateHandleProvider =
FileStateHandle
+ .createProvider(stateBackendPath);
+
+ return new ZooKeeperSubmittedJobGraphs(
+ client, zooKeeperSubmittedJobsPath,
stateHandleProvider);
+ }
+
+ /**
+ * Creates a {@link ZooKeeperCompletedCheckpoints} instance.
+ *
+ * @param client The {@link CuratorFramework}
ZooKeeper client to use
+ * @param configuration {@link Configuration} object
+ * @param jobId ID of job to create the
instance for
+ * @param maxNumberOfCheckpointsToRetain The maximum number of
checkpoints to retain
+ * @param userClassLoader User code class loader
+ * @return {@link ZooKeeperCompletedCheckpoints} instance
+ */
+ public static CompletedCheckpoints createCompletedCheckpoints(
+ CuratorFramework client,
+ Configuration configuration,
+ JobID jobId,
+ int maxNumberOfCheckpointsToRetain,
+ ClassLoader userClassLoader) throws Exception {
+
+ checkNotNull(configuration, "Configuration");
+
+ // State backend
+ String stateBackend = configuration.getString(
+ ConfigConstants.STATE_BACKEND,
+ ConfigConstants.DEFAULT_STATE_BACKEND);
+
+ if (!stateBackend.toLowerCase().equals("filesystem")) {
+ throw new IllegalConfigurationException(String.format(
+ "You currently have to configure the
filesystem state backend in order for " +
+ "ZooKeeper recovery to
work. Flink will use this backend to store " +
+ "meta data to recover
jobs. Please set '%s' to 'FILESYSTEM' in the " +
+ "configuration and set
the recovery path via key '%s'.",
+ ConfigConstants.STATE_BACKEND,
+
ConfigConstants.STATE_BACKEND_FS_RECOVERY_PATH));
+ }
+
+ // State backend root dir
+ String stateBackendPath = configuration.getString(
+ ConfigConstants.STATE_BACKEND_FS_RECOVERY_PATH,
+ "");
+
+ if (stateBackendPath.equals("")) {
+ throw new IllegalConfigurationException(String.format(
+ "You have to specify a path for the
file system state backend for storing " +
+ "recovery information.
Please set the configuration key '%s'.",
+
ConfigConstants.STATE_BACKEND_FS_RECOVERY_PATH));
+ }
--- End diff --
Resolved
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---