aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorMasterDDT <miteshp@live.com>2016-07-06 22:47:40 -0700
committerReynold Xin <rxin@databricks.com>2016-07-06 22:47:40 -0700
commit69f5391408b779a400b553344fd61051004685fc (patch)
treed48fd4452be85597a451421eb1048ab650dc33a2 /core
parent42279bff686f9808ec7a9e8f4da95c717edc6026 (diff)
downloadspark-69f5391408b779a400b553344fd61051004685fc.tar.gz
spark-69f5391408b779a400b553344fd61051004685fc.tar.bz2
spark-69f5391408b779a400b553344fd61051004685fc.zip
[SPARK-16398][CORE] Make cancelJob and cancelStage APIs public
## What changes were proposed in this pull request? Make SparkContext `cancelJob` and `cancelStage` APIs public. This allows applications to use `SparkListener` to do their own management of jobs via events, but without using the REST API. ## How was this patch tested? Existing tests (dev/run-tests) Author: MasterDDT <miteshp@live.com> Closes #14072 from MasterDDT/SPARK-16398.
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/SparkContext.scala18
1 files changed, 14 insertions, 4 deletions
diff --git a/core/src/main/scala/org/apache/spark/SparkContext.scala b/core/src/main/scala/org/apache/spark/SparkContext.scala
index fe15052b62..57d1f09f6b 100644
--- a/core/src/main/scala/org/apache/spark/SparkContext.scala
+++ b/core/src/main/scala/org/apache/spark/SparkContext.scala
@@ -2011,13 +2011,23 @@ class SparkContext(config: SparkConf) extends Logging with ExecutorAllocationCli
dagScheduler.cancelAllJobs()
}
- /** Cancel a given job if it's scheduled or running */
- private[spark] def cancelJob(jobId: Int) {
+ /**
+ * Cancel a given job if it's scheduled or running.
+ *
+ * @param jobId the job ID to cancel
+ * @throws InterruptedException if the cancel message cannot be sent
+ */
+ def cancelJob(jobId: Int) {
dagScheduler.cancelJob(jobId)
}
- /** Cancel a given stage and all jobs associated with it */
- private[spark] def cancelStage(stageId: Int) {
+ /**
+ * Cancel a given stage and all jobs associated with it.
+ *
+ * @param stageId the stage ID to cancel
+ * @throws InterruptedException if the cancel message cannot be sent
+ */
+ def cancelStage(stageId: Int) {
dagScheduler.cancelStage(stageId)
}