Skip to content
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,15 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
runEvent(JobCancelled(jobId, None))
}

/** Make task set success and check result. */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't make the whole taskset success but only some tasks in the taskset success?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You said right, I will change the comments.

private def checkAnswer(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, completeAndCheckAnswer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

taskSet: TaskSet,
results: Seq[(TaskEndReason, Any)],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the name of results is not appropriate here considering its usage and also confused with this.results below. Maybe, taskEndInfos?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update results to taskEndInfos for complete too.

expected: Map[Int, Any]): Unit = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 4 indents

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

complete(taskSet, results)
assert(this.results === expected)
}

test("[SPARK-3353] parent stage should have lower stage id") {
sc.parallelize(1 to 10).map(x => (x, x)).reduceByKey(_ + _, 4).count()
val stageByOrderOfExecution = sparkListener.stageByOrderOfExecution
Expand Down Expand Up @@ -461,8 +470,7 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
completeShuffleMapStageSuccessfully(0, 0, 1)
completeShuffleMapStageSuccessfully(1, 0, 1)
completeShuffleMapStageSuccessfully(2, 0, 1)
complete(taskSets(3), Seq((Success, 42)))
assert(results === Map(0 -> 42))
checkAnswer(taskSets(3), Seq((Success, 42)), Map(0 -> 42))
assertDataStructuresEmpty()
}

Expand Down Expand Up @@ -558,17 +566,15 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi

test("run trivial job") {
submit(new MyRDD(sc, 1, Nil), Array(0))
complete(taskSets(0), List((Success, 42)))
assert(results === Map(0 -> 42))
checkAnswer(taskSets(0), Seq((Success, 42)), Map(0 -> 42))
assertDataStructuresEmpty()
}

test("run trivial job w/ dependency") {
val baseRdd = new MyRDD(sc, 1, Nil)
val finalRdd = new MyRDD(sc, 1, List(new OneToOneDependency(baseRdd)))
submit(finalRdd, Array(0))
complete(taskSets(0), Seq((Success, 42)))
assert(results === Map(0 -> 42))
checkAnswer(taskSets(0), Seq((Success, 42)), Map(0 -> 42))
assertDataStructuresEmpty()
}

Expand All @@ -592,8 +598,7 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
submit(finalRdd, Array(0))
val taskSet = taskSets(0)
assertLocations(taskSet, Seq(Seq("hostA", "hostB")))
complete(taskSet, Seq((Success, 42)))
assert(results === Map(0 -> 42))
checkAnswer(taskSet, Seq((Success, 42)), Map(0 -> 42))
assertDataStructuresEmpty()
}

Expand Down Expand Up @@ -729,8 +734,7 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
assert(failure === null)

// When the task set completes normally, state should be correctly updated.
complete(taskSets(0), Seq((Success, 42)))
assert(results === Map(0 -> 42))
checkAnswer(taskSets(0), Seq((Success, 42)), Map(0 -> 42))
assertDataStructuresEmpty()

assert(sparkListener.failedStages.isEmpty)
Expand All @@ -746,8 +750,7 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
completeShuffleMapStageSuccessfully(0, 0, 1)
assert(mapOutputTracker.getMapSizesByExecutorId(shuffleId, 0).map(_._1).toSet ===
HashSet(makeBlockManagerId("hostA"), makeBlockManagerId("hostB")))
complete(taskSets(1), Seq((Success, 42)))
assert(results === Map(0 -> 42))
checkAnswer(taskSets(1), Seq((Success, 42)), Map(0 -> 42))
assertDataStructuresEmpty()
}

Expand All @@ -771,8 +774,7 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
// we can see both result blocks now
assert(mapOutputTracker.getMapSizesByExecutorId(shuffleId, 0).map(_._1.host).toSet ===
HashSet("hostA", "hostB"))
complete(taskSets(3), Seq((Success, 43)))
assert(results === Map(0 -> 42, 1 -> 43))
checkAnswer(taskSets(3), Seq((Success, 43)), Map(0 -> 42, 1 -> 43))
assertDataStructuresEmpty()
}

Expand Down Expand Up @@ -1454,8 +1456,7 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
HashSet(makeBlockManagerId("hostB"), makeBlockManagerId("hostA")))

// finish the next stage normally, which completes the job
complete(taskSets(1), Seq((Success, 42), (Success, 43)))
assert(results === Map(0 -> 42, 1 -> 43))
checkAnswer(taskSets(1), Seq((Success, 42), (Success, 43)), Map(0 -> 42, 1 -> 43))
assertDataStructuresEmpty()
}

Expand Down Expand Up @@ -1796,9 +1797,7 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi

// lets say there is a fetch failure in this task set, which makes us go back and
// run stage 0, attempt 1
complete(taskSets(1), Seq(
(FetchFailed(makeBlockManagerId("hostA"),
shuffleDep1.shuffleId, 0L, 0, 0, "ignored"), null)))
completeNextStageWithFetchFailure(1, 0, shuffleDep1)
scheduler.resubmitFailedStages()

// stage 0, attempt 1 should have the properties of job2
Expand Down Expand Up @@ -1872,9 +1871,7 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
// have the second stage complete normally
completeShuffleMapStageSuccessfully(1, 0, 1, Seq("hostA", "hostC"))
// fail the third stage because hostA went down
complete(taskSets(2), Seq(
(FetchFailed(makeBlockManagerId("hostA"),
shuffleDepTwo.shuffleId, 0L, 0, 0, "ignored"), null)))
completeNextStageWithFetchFailure(2, 0, shuffleDepTwo)
// TODO assert this:
// blockManagerMaster.removeExecutor("hostA-exec")
// have DAGScheduler try again
Expand All @@ -1900,9 +1897,7 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
// complete stage 1
completeShuffleMapStageSuccessfully(1, 0, 1)
// pretend stage 2 failed because hostA went down
complete(taskSets(2), Seq(
(FetchFailed(makeBlockManagerId("hostA"),
shuffleDepTwo.shuffleId, 0L, 0, 0, "ignored"), null)))
completeNextStageWithFetchFailure(2, 0, shuffleDepTwo)
// TODO assert this:
// blockManagerMaster.removeExecutor("hostA-exec")
// DAGScheduler should notice the cached copy of the second shuffle and try to get it rerun.
Expand Down