dawidwys 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_r347792653
##########
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:
I agree. There is one additional caveat in here. If the option is used on
the server side, the fallback/default option assumes the string is a class name
of a custom user provided restart strategy, which makes it even more
complicated to migrate this option to enum in a backward compatible way.
----------------------------------------------------------------
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