[GitHub] incubator-gearpump pull request #156: [GEARPUMP-277] Allow user to configure...

2017-02-22 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/incubator-gearpump/pull/156


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-gearpump pull request #156: [GEARPUMP-277] Allow user to configure...

2017-02-21 Thread manuzhang
Github user manuzhang commented on a diff in the pull request:

https://github.com/apache/incubator-gearpump/pull/156#discussion_r102383178
  
--- Diff: core/src/main/scala/org/apache/gearpump/util/Constants.scala ---
@@ -163,5 +163,11 @@ object Constants {
 
   val APPLICATION_EXECUTOR_NUMBER = "gearpump.application.executor-num"
 
+  val APPLICATION_TOTAL_RETRIES = "gearpump.application.ha.total-retries"
+
+  val APPLICATION_MAX_RETRIES_IN_WINDOW = 
"gearpump.application.ha.maximum-retries-in-window"
+
+  val APPLICATION_RETRY_TIME_WINDOW = 
"gearpump.application.ha.retry-time-window"
--- End diff --

is this used anywhere ?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-gearpump pull request #156: [GEARPUMP-277] Allow user to configure...

2017-02-21 Thread manuzhang
Github user manuzhang commented on a diff in the pull request:

https://github.com/apache/incubator-gearpump/pull/156#discussion_r102384171
  
--- Diff: core/src/main/scala/org/apache/gearpump/util/RestartPolicy.scala 
---
@@ -26,16 +26,24 @@ import akka.actor.ChildRestartStats
  * When one executor or task fails, Gearpump will try to start. However, 
if it fails after
  * multiple retries, then we abort.
  *
- * @param maxNrOfRetries The number of times is allowed to be restarted, 
negative value means no
- *   limit, if the limit is exceeded the policy will 
not allow to restart
+ * @param totalNrOfRetries The total number of times is allowed to be 
restarted, negative value
+ * means no limit, if the limit is exceeded the 
policy will not allow
+ * to restart
+ * @param maxNrOfRetriesInRange The maximum retry times in the specified 
time window.
  * @param withinTimeRange Duration of the time window for maxNrOfRetries.
  *Duration.Inf means no window
  */
-class RestartPolicy(maxNrOfRetries: Int, withinTimeRange: Duration) {
+class RestartPolicy(totalNrOfRetries: Int, maxNrOfRetriesInRange: Int, 
withinTimeRange: Duration) {
+  private var historicalRetries: Int = 0
   private val status = new ChildRestartStats(null, 0, 0L)
-  private val retriesWindow = (Some(maxNrOfRetries), 
Some(withinTimeRange.toMillis.toInt))
+  private val retriesWindow = (Some(maxNrOfRetriesInRange), 
Some(withinTimeRange.toMillis.toInt))
 
   def allowRestart: Boolean = {
-status.requestRestartPermission(retriesWindow)
+historicalRetries += 1
+if (totalNrOfRetries > 0 && historicalRetries > totalNrOfRetries) {
--- End diff --

We mixed our own policy with Akka's implementation here. Can we make 
it simpler ? Is restarting based on number of retries, i.e. `retriesWindow = 
(Some(maxNrOfRetriesInRange), None)` good enough ?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-gearpump pull request #156: [GEARPUMP-277] Allow user to configure...

2017-02-21 Thread manuzhang
Github user manuzhang commented on a diff in the pull request:

https://github.com/apache/incubator-gearpump/pull/156#discussion_r102383159
  
--- Diff: core/src/main/scala/org/apache/gearpump/util/Constants.scala ---
@@ -163,5 +163,11 @@ object Constants {
 
   val APPLICATION_EXECUTOR_NUMBER = "gearpump.application.executor-num"
 
+  val APPLICATION_TOTAL_RETRIES = "gearpump.application.ha.total-retries"
+
+  val APPLICATION_MAX_RETRIES_IN_WINDOW = 
"gearpump.application.ha.maximum-retries-in-window"
--- End diff --

is this used anywhere ?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-gearpump pull request #156: [GEARPUMP-277] Allow user to configure...

2017-02-21 Thread huafengw
GitHub user huafengw opened a pull request:

https://github.com/apache/incubator-gearpump/pull/156

[GEARPUMP-277] Allow user to configure retry times on application fai…

…lure

Be sure to do all of the following to help us incorporate your contribution
quickly and easily:

 - [ ] Make sure the commit message is formatted like:
   `[GEARPUMP-] Meaningful description of pull request` 
 - [ ] Make sure tests pass via `sbt clean test`.
 - [ ] Make sure old documentation affected by the pull request has been 
updated and new documentation added for new functionality. 



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/huafengw/incubator-gearpump fix277

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-gearpump/pull/156.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #156


commit 0ff0aea2de20280c610d8c1d9016be6a6292e2a2
Author: huafengw 
Date:   2017-02-21T09:29:19Z

[GEARPUMP-277] Allow user to configure retry times on application failure




---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---