Github user sameeragarwal commented on a diff in the pull request:
https://github.com/apache/spark/pull/17244#discussion_r105785854
--- Diff:
core/src/test/scala/org/apache/spark/scheduler/TaskContextSuite.scala ---
@@ -228,6 +228,31 @@ class TaskContextSuite extends SparkFunSuite with
BeforeAndAfter with LocalSpark
assert(res === Array("testPropValue,testPropValue"))
}
+ test("immediately call a completion listener if the context is
completed") {
+ var invocations = 0
+ val context = TaskContext.empty()
+ context.markTaskCompleted()
+ context.addTaskCompletionListener(_ => invocations += 1)
+ assert(invocations == 1)
+ context.markTaskCompleted()
+ assert(invocations == 2)
--- End diff --
can we call `context.markTaskCompleted()` once again and assert
`invocations == 2` to have a test for idempotency?
---
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]