Repository: spark
Updated Branches:
  refs/heads/branch-1.0 b633559f8 -> c4fbcaec6


[SPARK-4787] Stop SparkContext if a DAGScheduler init error occurs

Author: Dale <[email protected]>

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 <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/c4fbcaec
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/c4fbcaec
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/c4fbcaec

Branch: refs/heads/branch-1.0
Commit: c4fbcaec67c3948bc0f8baf21bb657528f2e3058
Parents: b633559
Author: Dale <[email protected]>
Authored: Sun Jan 4 13:28:37 2015 -0800
Committer: Josh Rosen <[email protected]>
Committed: Sun Jan 4 13:30:29 2015 -0800

----------------------------------------------------------------------
 core/src/main/scala/org/apache/spark/SparkContext.scala | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/c4fbcaec/core/src/main/scala/org/apache/spark/SparkContext.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/SparkContext.scala 
b/core/src/main/scala/org/apache/spark/SparkContext.scala
index a211d23..59cd78e 100644
--- a/core/src/main/scala/org/apache/spark/SparkContext.scala
+++ b/core/src/main/scala/org/apache/spark/SparkContext.scala
@@ -310,8 +310,13 @@ class SparkContext(config: SparkConf) extends Logging {
   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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to