Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/4008#discussion_r22828514
--- Diff: core/src/main/java/org/apache/spark/TaskContext.java ---
@@ -94,6 +94,14 @@ static void unset() {
@Deprecated
public abstract void addOnCompleteCallback(final Function0<Unit> f);
+ /**
+ * Add a callback function to be executed on task stop.
+ * This will be called when task is being killed.
+ *
+ * @param f Callback function.
+ */
+ public abstract void addOnStopCallback(final Function1<String, Unit> f);
--- End diff --
Unfortunately, I guess we can't add a new method to
`TaskCompletionListener` because it's a public trait that's designed to be
extended from Java, so adding any new methods will break source-compatibility
for those users:
https://github.com/uncleGen/spark/blob/master-clean-150112/core/src/main/scala/org/apache/spark/util/TaskCompletionListener.scala
I suppose we could add a separate TaskKillListener or something like that.
---
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]