-
Notifications
You must be signed in to change notification settings - Fork 29k
spark-core - [SPARK-4787] - Stop sparkcontext properly if a DAGScheduler init error occurs #3809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -329,8 +329,11 @@ 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 => { | ||
| stop() | ||
| throw | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style nit: you can use string interpolation instead of String.format, which will allow the throw new SparkException(s"DAGScheduler cannot be initialized due to ${e.getMessage}")However, I'd prefer to call the two-argument constructor which takes the cause as second argument, since this will lead to more informative stacktraces: throw new SparkException("Error while constructing DAGScheduler", e) |
||
| new SparkException("DAGScheduler cannot be initialized due to %s".format(e.getMessage)) | ||
| } | ||
| } | ||
|
|
||
| // start TaskScheduler after taskScheduler sets DAGScheduler reference in DAGScheduler's | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, do you think this should be in a try-finally block so that we don't swallow the useful "DAGScheduler could not be initialized" exception if the stop() call somehow fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent idea Josh.