You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "1996fanrui (via GitHub)" <gi...@apache.org> on 2023/12/17 14:51:39 UTC

[PR] [FLINK-33865][runtime] Support setting `exponential-delay.attempts-before-reset-backoff` when it's set in Job Configuration [flink]

1996fanrui opened a new pull request, #23942:
URL: https://github.com/apache/flink/pull/23942

   Draft PR


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-33865][runtime] Adding an ITCase to ensure `exponential-delay.attempts-before-reset-backoff` works well [flink]

Posted by "qinf (via GitHub)" <gi...@apache.org>.
qinf commented on code in PR #23942:
URL: https://github.com/apache/flink/pull/23942#discussion_r1462656608


##########
flink-core/src/main/java/org/apache/flink/configuration/RestartStrategyOptions.java:
##########
@@ -55,6 +64,54 @@ public class RestartStrategyOptions {
 
     @Internal public static final String RESTART_STRATEGY_CONFIG_PREFIX = "restart-strategy";
 
+    /** The restart strategy type. */
+    @Internal
+    public enum RestartStrategyType {
+        NO_RESTART_STRATEGY("disable", Sets.newHashSet("none", "off")),
+        FIXED_DELAY("fixed-delay", Sets.newHashSet("fixeddelay")),
+        FAILURE_RATE("failure-rate", Sets.newHashSet("failurerate")),
+        EXPONENTIAL_DELAY("exponential-delay", Sets.newHashSet("exponentialdelay"));
+
+        private final String mainValue;
+        private final Set<String> allAvailableValues;
+
+        RestartStrategyType(String mainValue, Set<String> otherAvailableValues) {
+            this.mainValue = mainValue;
+            this.allAvailableValues = Sets.newHashSet(mainValue);
+            allAvailableValues.addAll(otherAvailableValues);
+        }
+
+        /** Return the corresponding RestartStrategyType based on the displayed value. */
+        public static RestartStrategyType getTypeFromValue(String value) {
+            for (RestartStrategyType restartStrategyType : RestartStrategyType.values()) {

Review Comment:
   @1996fanrui How about making it even simpler by using of() instead of getTypeFromValue()? 



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-33865][runtime] Adding an ITCase to ensure `exponential-delay.attempts-before-reset-backoff` works well [flink]

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui commented on code in PR #23942:
URL: https://github.com/apache/flink/pull/23942#discussion_r1462744107


##########
flink-core/src/main/java/org/apache/flink/configuration/RestartStrategyOptions.java:
##########
@@ -55,6 +64,54 @@ public class RestartStrategyOptions {
 
     @Internal public static final String RESTART_STRATEGY_CONFIG_PREFIX = "restart-strategy";
 
+    /** The restart strategy type. */
+    @Internal
+    public enum RestartStrategyType {
+        NO_RESTART_STRATEGY("disable", Sets.newHashSet("none", "off")),
+        FIXED_DELAY("fixed-delay", Sets.newHashSet("fixeddelay")),
+        FAILURE_RATE("failure-rate", Sets.newHashSet("failurerate")),
+        EXPONENTIAL_DELAY("exponential-delay", Sets.newHashSet("exponentialdelay"));
+
+        private final String mainValue;
+        private final Set<String> allAvailableValues;
+
+        RestartStrategyType(String mainValue, Set<String> otherAvailableValues) {
+            this.mainValue = mainValue;
+            this.allAvailableValues = Sets.newHashSet(mainValue);
+            allAvailableValues.addAll(otherAvailableValues);
+        }
+
+        /** Return the corresponding RestartStrategyType based on the displayed value. */
+        public static RestartStrategyType getTypeFromValue(String value) {
+            for (RestartStrategyType restartStrategyType : RestartStrategyType.values()) {

Review Comment:
   Thanks @qinf for the review! Updated.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-33865][runtime] Adding an ITCase to ensure `exponential-delay.attempts-before-reset-backoff` works well [flink]

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui commented on PR #23942:
URL: https://github.com/apache/flink/pull/23942#issuecomment-1899899509

   @flinkbot run azure


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-33865][runtime] Support setting `exponential-delay.attempts-before-reset-backoff` when it's set in Job Configuration [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #23942:
URL: https://github.com/apache/flink/pull/23942#issuecomment-1859194965

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fce08fa4150978ab8c7ea743ac17cacc6d565d26",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "fce08fa4150978ab8c7ea743ac17cacc6d565d26",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fce08fa4150978ab8c7ea743ac17cacc6d565d26 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-33865][runtime] Adding an ITCase to ensure `exponential-delay.attempts-before-reset-backoff` works well [flink]

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui merged PR #23942:
URL: https://github.com/apache/flink/pull/23942


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-33865][runtime] Adding an ITCase to ensure `exponential-delay.attempts-before-reset-backoff` works well [flink]

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui commented on PR #23942:
URL: https://github.com/apache/flink/pull/23942#issuecomment-1907277744

   @flinkbot run azure


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-33865][runtime] Adding an ITCase to ensure `exponential-delay.attempts-before-reset-backoff` works well [flink]

Posted by "1996fanrui (via GitHub)" <gi...@apache.org>.
1996fanrui commented on PR #23942:
URL: https://github.com/apache/flink/pull/23942#issuecomment-1907374215

   Thanks @RocMarshal for the review!
   
   > Thanks @1996fanrui for the contribution, But the CI failed. could you check it? LGTM +1.
   
   I checked it, and it's not related to this PR. I created the FLINK-34218 to follow it.
   
   I try to run the CI again, it's green now, merging~


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-33865][runtime] Support setting `exponential-delay.attempts-before-reset-backoff` when it's set in Job Configuration [flink]

Posted by "zhuzhurk (via GitHub)" <gi...@apache.org>.
zhuzhurk commented on PR #23942:
URL: https://github.com/apache/flink/pull/23942#issuecomment-1863767529

   How about to add an internal method `RestartStrategies#exponentialDelayRestart(...)` which accepts the attempts param and modify `RestartStrategies#fromConfiguration(...)` accordingly? The change can be much simpler, which I think is better for the deprecated code path.
   @JunRuiLee is currently working on a common solution to pass all job configuration to JM and use it to create restartStrategy/stateBackend/etc. So I prefer to not solve it case by case which will lead to unnecessary conflicts.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-33865][runtime] Support setting `exponential-delay.attempts-before-reset-backoff` when it's set in Job Configuration [flink]

Posted by "zhuzhurk (via GitHub)" <gi...@apache.org>.
zhuzhurk commented on PR #23942:
URL: https://github.com/apache/flink/pull/23942#issuecomment-1863877534

   > Hi @zhuzhurk , thanks a lot for the comment in advance. The current PR is still missing some tests. I originally planned to develop all the tests and then find you and @JunRuiLee .
   > 
   > > How about to add an internal method `RestartStrategies#exponentialDelayRestart(...)` which accepts the attempts param and modify `RestartStrategies#fromConfiguration(...)` accordingly? The change can be much simpler, which I think is better for the deprecated code path. @JunRuiLee is currently working on a common solution to pass all job configuration to JM and use it to create restartStrategy/stateBackend/etc. So I prefer to not solve it case by case which will lead to unnecessary conflicts.
   > 
   > I also consider the solution you mentioned, which is really simple. The solution of current PR is using the `Configuration` to save the `restartStrategy options` inside of ExecutionConfig instead of `RestartStrategyConfiguration` object.
   > 
   > For the convenience of comparison, I use SolutionA and SolutionB for them:
   > 
   > * SolutionA: Using the `RestartStrategyConfiguration` object to save `restartStrategy options`
   > * SolutionB: Using the `Configuration` to save `restartStrategy options`
   > 
   > I prefer SolutionB because some reasons:
   > 
   > * `RestartStrategyConfiguration` and all sub-classes are the inner class of `RestartStrategies`. And `RestartStrategies` has been Deprecated. So we can consider `RestartStrategyConfiguration` and all sub-classes have been Depreacated.
   >   
   >   * SolutionA still uses dereacated classes, they cannot be removed it in 2.0.
   >   * SolutionB doesn't use them, we can remove these classes in 2.0 directly.
   > * If we add other options in the future, SolutionA still needs to update these classes.
   > * It is more intuitive to use ConfigOptions to store all Options to Configuration.
   >   
   >   * We recommend users using `ConfigOptions` or key name to using the restart strategy.
   >   * If flink developers using them in flink code directly, it's easy to maintain.
   > * The change of SolutionA is simpler than SolutionB, because current master branch code is SolutionA.
   >   
   >   * This PR(SolutionB) has some of code to compatible with `RestartStrategyConfiguration`, that's why this change is big.
   >   * Actually, most of changes are unit tests, I need to test whether SolutionB compatible with `RestartStrategyConfiguration`.
   >   * I believe our code will be clearer if we remove `RestartStrategies` and all classes related to `RestartStrategyConfiguration` in 2.0.
   > 
   > After this PR, I believe SolutionB is very easy to add new options.
   > 
   > WDYT? Looking forward to your suggestion, thanks!
   
   @JunRuiLee is working on a common solution which uses configuration to save restartStrategy options, as well as other config options, but the implementation is different, e.g. do not create restart strategy configuration first and later convert it to config option. This means that the benefits of solution A can be covered by the common solution, while solution B will add extra complexity and possible conflicts.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org