aljoscha commented on a change in pull request #10217:
[FLINK-14786][configuration] Add configure method to ExecutionConfig
URL: https://github.com/apache/flink/pull/10217#discussion_r347492668
##########
File path:
flink-core/src/main/java/org/apache/flink/api/common/restartstrategy/RestartStrategies.java
##########
@@ -249,4 +270,42 @@ public int hashCode() {
return Objects.hash();
}
}
+
+ /**
+ * Reads a {@link RestartStrategyConfiguration} from a given {@link
ReadableConfig}.
+ *
+ * @param configuration configuration object to retrieve parameters from
+ * @return {@link Optional#empty()} when no restart strategy parameters
provided
+ */
+ public static Optional<RestartStrategyConfiguration>
fromConfiguration(ReadableConfig configuration) {
+ return
configuration.getOptional(RestartStrategyOptions.RESTART_STRATEGY)
+ .map(confName -> parseConfiguration(confName,
configuration));
+ }
+
+ private static RestartStrategyConfiguration parseConfiguration(
+ String restartstrategyKind,
+ ReadableConfig configuration) {
+ switch (restartstrategyKind.toLowerCase()) {
Review comment:
This seems a bit fragile. Not a comment about your PR, because the existing
code is already using a string and not an enum for this.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services