Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/4135#discussion_r28023099
--- Diff:
core/src/test/scala/org/apache/spark/scheduler/TaskContextSuite.scala ---
@@ -64,6 +64,53 @@ class TaskContextSuite extends FunSuite with
BeforeAndAfter with LocalSparkConte
verify(listener, times(1)).onTaskCompletion(any())
}
+ test("calls TaskInterruptionListener when task killed") {
+ TaskContextSuite.interrupted = false
+ sc = new SparkContext("local", "test")
+ val rdd = new RDD[String](sc, List()) {
+ override def getPartitions = Array[Partition](StubPartition(0))
+ override def compute(split: Partition, context: TaskContext) = {
+ context.addTaskInterruptionListener(context =>
TaskContextSuite.interrupted = true)
+ Thread.sleep(1000)
+ Iterator("test")
+ }
+ }
+ val closureSerializer = SparkEnv.get.closureSerializer.newInstance()
+ val func = (c: TaskContext, i: Iterator[String]) => i.next()
+ val task = new ResultTask[String, String](
+ 0, sc.broadcast(closureSerializer.serialize((rdd, func)).array),
rdd.partitions(0), Seq(), 0)
+
+ task.kill(false)
--- End diff --
The task isn't running at this point, so what's the purpose of calling
`kill` here?
---
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]