Github user squito commented on a diff in the pull request:
https://github.com/apache/spark/pull/5636#discussion_r35589472
--- Diff: core/src/main/scala/org/apache/spark/scheduler/Stage.scala ---
@@ -76,6 +76,33 @@ private[spark] abstract class Stage(
*/
private var _latestInfo: StageInfo = StageInfo.fromStage(this,
nextAttemptId)
+ /**
+ * Spark is resilient to executors dying by retrying stages on
FetchFailures. Here, we keep track
+ * of the number of stage failures to prevent endless stage retries.
+ */
+ private var failedStageCount = 0
+
+ private[scheduler] def clearFailures() : Unit = {
+ failedStageCount = 0
+ }
+
+ /**
+ * Check whether we should abort the failedStage due to multiple
failures.
+ * This method updates the running count of failures for a particular
stage and returns
+ * true if the number of failures exceeds the allowable number of
failures.
+ */
+ private[scheduler] def failAndShouldAbort(): Boolean = {
+ // We increment the failure count on the first attempt for a
particular Stage
+ if (_latestInfo.attemptId == 0)
+ {
+ failedStageCount += 1
+ }
--- End diff --
This is counting to count all failures from attempt 0, but no failures from
other attempts. That is not what we want -- we want to count one failure per
attempt. I think this method needs to take a `task` as a parameter, so you can
compare that task's stage attempt w/ the current attempt.
```scala
private[scheduler] def failAndShouldAbort(task: Task[_]): Boolean = {
failedAttempts += task.stageAttemptId // failedAttempts is a Set[Int]
...
```
We *might* be able to optimize this by just keeping track of a count of
stage failures, and making sure we only ever enter this method once per stage
attempt ... but it seems so much safer to me to just keep a set of failed
attempts. The max size of that set is very small, and it just makes it much
easier to reason about.
---
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.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]