juliuszsompolski opened a new pull request, #41440: URL: https://github.com/apache/spark/pull/41440
### What changes were proposed in this pull request? Currently, the only way to cancel running Spark Jobs is by using `SparkContext.cancelJobGroup`, using a job group name that was previously set using `SparkContext.setJobGroup`. This is problematic if multiple different parts of the system want to do cancellation, and set their own ids. For example, BroadcastExchangeExec sets it's own job group, which may override job group set by user. This way, if user cancels the job group they set in the "parent" execution, it will not cancel these broadcast jobs launches from within their jobs. It would also be useful in e.g. Spark Connect to be able to cancel jobs without overriding jobGroupId, which may be used and needed for other purposes. As a solution, consider add API to set tags on jobs, and to cancel jobs using tags: * `SparkContext.addJobTag(tagName: String): Unit` * `SparkContext.removeJobTag(tagName: String): Unit` * `SparkContext.clearJobTags(): Unit` * `SparkContext.cancelJobsWithTag(tagName: String): Unit` * `DAGScheduler.cancelJobsWithTag(tagName: String): Unit` The new API is used in BroadcastExchangeExec instead of cancellation using job group. ### Why are the changes needed? Currently, there may be multiple places that want to cancel a set of jobs, with different scopes. ### Does this PR introduce _any_ user-facing change? The APIs described above are added. ### How was this patch tested? Added test to JobCancellationSuite. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org