aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorDale <tigerquoll@outlook.com>2015-01-04 13:28:37 -0800
committerJosh Rosen <joshrosen@databricks.com>2015-01-04 13:29:48 -0800
commit9dbb62e6f7071f6e17ee9edc4faba74a69b90491 (patch)
tree808dadce61c978e555796e920c9f094aa1ce8113 /core
parent93617dd5b8119efc6cd96b5299f1caa2f5bbce64 (diff)
downloadspark-9dbb62e6f7071f6e17ee9edc4faba74a69b90491.tar.gz
spark-9dbb62e6f7071f6e17ee9edc4faba74a69b90491.tar.bz2
spark-9dbb62e6f7071f6e17ee9edc4faba74a69b90491.zip
[SPARK-4787] Stop SparkContext if a DAGScheduler init error occurs
Author: Dale <tigerquoll@outlook.com> Closes #3809 from tigerquoll/SPARK-4787 and squashes the following commits: 5661e01 [Dale] [SPARK-4787] Ensure that call to stop() doesn't lose the exception by using a finally block. 2172578 [Dale] [SPARK-4787] Stop context properly if an exception occurs during DAGScheduler initialization. (cherry picked from commit 3fddc9468fa50e7683caa973fec6c52e1132268d) Signed-off-by: Josh Rosen <joshrosen@databricks.com>
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/SparkContext.scala9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/src/main/scala/org/apache/spark/SparkContext.scala b/core/src/main/scala/org/apache/spark/SparkContext.scala
index 9d3d1e1d2b..1f853198c6 100644
--- a/core/src/main/scala/org/apache/spark/SparkContext.scala
+++ b/core/src/main/scala/org/apache/spark/SparkContext.scala
@@ -326,8 +326,13 @@ class SparkContext(config: SparkConf) extends Logging with ExecutorAllocationCli
try {
dagScheduler = new DAGScheduler(this)
} catch {
- case e: Exception => throw
- new SparkException("DAGScheduler cannot be initialized due to %s".format(e.getMessage))
+ case e: Exception => {
+ try {
+ stop()
+ } finally {
+ throw new SparkException("Error while constructing DAGScheduler", e)
+ }
+ }
}
// start TaskScheduler after taskScheduler sets DAGScheduler reference in DAGScheduler's