Github user mridulm commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16389#discussion_r93787886
  
    --- Diff: 
core/src/test/scala/org/apache/spark/ExecutorAllocationManagerSuite.scala ---
    @@ -938,6 +938,33 @@ class ExecutorAllocationManagerSuite
         assert(removeTimes(manager) === Map.empty)
       }
     
    +  test("SPARK-18981: maxNumExecutorsNeeded should properly handle 
speculated tasks") {
    +    sc = createSparkContext()
    +    val manager = sc.executorAllocationManager.get
    +    assert(maxNumExecutorsNeeded(manager) === 0)
    +
    +    val stageInfo = createStageInfo(0, 1)
    +    sc.listenerBus.postToAll(SparkListenerStageSubmitted(stageInfo))
    +    assert(maxNumExecutorsNeeded(manager) === 1)
    +
    +    val taskInfo = createTaskInfo(1, 1, "executor-1")
    +    val speculatedTaskInfo = createTaskInfo(2, 1, "executor-1")
    +    sc.listenerBus.postToAll(SparkListenerTaskStart(0, 0, taskInfo))
    +    assert(maxNumExecutorsNeeded(manager) === 1)
    --- End diff --
    
    This tests looks wrong - taskIndex is higher than numTasks ?
    Would be better for the test to :
    * Launch stage with 1 task.
    * Launch a normal task and 1 speculative task - with same taskIndex, but 
different taskId's
    * Finish normal task.
    * Ensure stage is completed.
    * Now finish speculative task and check if bug is not reproduced (it should 
be reproduced without this fix).


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to