Github user mateiz commented on a diff in the pull request:
https://github.com/apache/spark/pull/7699#discussion_r37919314
--- Diff:
core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
@@ -695,6 +696,115 @@ class DAGSchedulerSuite
assertDataStructuresEmpty()
}
+ test("don't submit stage until its dependencies map outputs are
registered (SPARK-5259)") {
+ val firstRDD = new MyRDD(sc, 3, Nil)
+ val firstShuffleDep = new ShuffleDependency(firstRDD, null)
+ val firstShuffleId = firstShuffleDep.shuffleId
+ val shuffleMapRdd = new MyRDD(sc, 3, List(firstShuffleDep))
+ val shuffleDep = new ShuffleDependency(shuffleMapRdd, null)
+ val reduceRdd = new MyRDD(sc, 1, List(shuffleDep))
+ submit(reduceRdd, Array(0))
+
+ // things start out smoothly, stage 0 completes with no issues
+ complete(taskSets(0), Seq(
+ (Success, makeMapStatus("hostB", shuffleMapRdd.partitions.length)),
+ (Success, makeMapStatus("hostB", shuffleMapRdd.partitions.length)),
+ (Success, makeMapStatus("hostA", shuffleMapRdd.partitions.length))
+ ))
+
+ // then one executor dies, and a task fails in stage 1
+ runEvent(ExecutorLost("exec-hostA"))
+ runEvent(CompletionEvent(
+ taskSets(1).tasks(0),
+ FetchFailed(null, firstShuffleId, 2, 0, "Fetch failed"),
+ null,
+ null,
+ createFakeTaskInfo(),
+ null))
+
+ // so we resubmit stage 0, which completes happily
+ scheduler.resubmitFailedStages()
+ val stage0Resubmit = taskSets(2)
+ assert(stage0Resubmit.stageId == 0)
+ assert(stage0Resubmit.stageAttemptId === 1)
+ val task = stage0Resubmit.tasks(0)
+ assert(task.partitionId === 2)
+ runEvent(CompletionEvent(
+ task,
+ Success,
+ makeMapStatus("hostC", shuffleMapRdd.partitions.length),
+ null,
+ createFakeTaskInfo(),
+ null))
+
+ // now here is where things get tricky : we will now have a task set
representing
+ // the second attempt for stage 1, but we *also* have some tasks for
the first attempt for
+ // stage 1 still going
+ val stage1Resubmit = taskSets(3)
+ assert(stage1Resubmit.stageId == 1)
+ assert(stage1Resubmit.stageAttemptId === 1)
+ assert(stage1Resubmit.tasks.length === 3)
+
+ // we'll have some tasks finish from the first attempt, and some
finish from the second attempt,
+ // so that we actually have all stage outputs, though no attempt has
completed all its
+ // tasks
+ runEvent(CompletionEvent(
+ taskSets(3).tasks(0),
+ Success,
+ makeMapStatus("hostC", reduceRdd.partitions.length),
+ null,
+ createFakeTaskInfo(),
+ null))
+ runEvent(CompletionEvent(
+ taskSets(3).tasks(1),
+ Success,
+ makeMapStatus("hostC", reduceRdd.partitions.length),
+ null,
+ createFakeTaskInfo(),
+ null))
+ // late task finish from the first attempt
+ runEvent(CompletionEvent(
+ taskSets(1).tasks(2),
+ Success,
+ makeMapStatus("hostB", reduceRdd.partitions.length),
+ null,
+ createFakeTaskInfo(),
+ null))
+
+ // What should happen now is that we submit stage 2. However, we
might not see an error
+ // b/c of DAGScheduler's error handling (it tends to swallow errors
and just log them). But
+ // we can check some conditions.
--- End diff --
Instead of doing this, why not add a mechanism to grab the errors during
tests? Doesn't have to be in this PR but it would make more sense.
---
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]