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

    https://github.com/apache/spark/pull/16855#discussion_r100189090
  
    --- Diff: 
core/src/test/scala/org/apache/spark/scheduler/TaskSetManagerSuite.scala ---
    @@ -664,6 +665,55 @@ class TaskSetManagerSuite extends SparkFunSuite with 
LocalSparkContext with Logg
         assert(thrown2.getMessage().contains("bigger than 
spark.driver.maxResultSize"))
       }
     
    +  test("taskSetManager should not send Resubmitted tasks after being a 
zombie") {
    +    // Regression test for SPARK-13931
    +    val conf = new SparkConf().set("spark.speculation", "true")
    +    sc = new SparkContext("local", "test", conf)
    +
    +    val sched = new FakeTaskScheduler(sc, ("execA", "host1"), ("execB", 
"host2"))
    +    sched.initialize(new FakeSchedulerBackend() {
    +      override def killTask(taskId: Long, executorId: String, 
interruptThread: Boolean): Unit = {}
    +    })
    +
    +    // count for Resubmitted tasks
    +    var resubmittedTasks = 0
    +    val dagScheduler = new FakeDAGScheduler(sc, sched) {
    +      override def taskEnded(task: Task[_], reason: TaskEndReason, result: 
Any,
    +                             accumUpdates: Seq[AccumulatorV2[_, _]], 
taskInfo: TaskInfo): Unit = {
    +        super.taskEnded(task, reason, result, accumUpdates, taskInfo)
    +        reason match {
    +          case Resubmitted => resubmittedTasks += 1
    +          case _ =>
    +        }
    +      }
    +    }
    +    sched.setDAGScheduler(dagScheduler)
    +
    +    val tasks = Array.tabulate[Task[_]](1) { i =>
    +      new ShuffleMapTask(i, 0, null, new Partition {
    +        override def index: Int = 0
    +      }, Seq(TaskLocation("host1", "execA")), new Properties, null)
    +    }
    +    val taskSet = new TaskSet(tasks, 0, 0, 0, null)
    +    val manager = new TaskSetManager(sched, taskSet, MAX_TASK_FAILURES)
    +    manager.speculatableTasks += tasks.head.partitionId
    +    val task1 = manager.resourceOffer("execA", "host1", 
TaskLocality.PROCESS_LOCAL).get
    +    val task2 = manager.resourceOffer("execB", "host2", 
TaskLocality.ANY).get
    +
    +    assert(manager.runningTasks == 2)
    --- End diff --
    
    can you use triple equals here and below? That way Scala Test will print 
out the expected and actual values automatically.


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