-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-15703] [Scheduler][Core][WebUI] Make ListenerBus event queue size configurable #14269
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9c0cb44
[SPARK-15703] Make ListenerBus event queue configurable
dhruve 76d9af8
[SPARK-15703] Make ListenerBus event queue size ConfigEntry and updat…
dhruve 09e855e
[SPARK-15703] Fixes test failures to ensure single sc
dhruve 41dc57c
[SPARK-15703] Fixes import ordering
dhruve 889fe66
Remove extra line
dhruve 82feec4
[SPARK-15703] Remove unused import
dhruve File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
[SPARK-15703] Make ListenerBus event queue configurable
- Loading branch information
commit 9c0cb445856cfd4384287c1ac00c4f6a87cdb52a
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,18 +32,17 @@ import org.apache.spark.util.Utils | |
| * has started will events be actually propagated to all attached listeners. This listener bus | ||
| * is stopped when `stop()` is called, and it will drop further events after stopping. | ||
| */ | ||
| private[spark] class LiveListenerBus extends SparkListenerBus { | ||
| private[spark] class LiveListenerBus(val sparkContext: SparkContext) extends SparkListenerBus { | ||
|
|
||
| self => | ||
|
|
||
| import LiveListenerBus._ | ||
|
|
||
| private var sparkContext: SparkContext = null | ||
|
|
||
| // Cap the capacity of the event queue so we get an explicit error (rather than | ||
| // an OOM exception) if it's perpetually being added to more quickly than it's being drained. | ||
| private val EVENT_QUEUE_CAPACITY = 10000 | ||
| private val eventQueue = new LinkedBlockingQueue[SparkListenerEvent](EVENT_QUEUE_CAPACITY) | ||
| private lazy val EVENT_QUEUE_CAPACITY = sparkContext.conf. | ||
| getInt("spark.scheduler.listenerbus.eventqueue.size", 10000) | ||
|
||
| private lazy val eventQueue = new LinkedBlockingQueue[SparkListenerEvent](EVENT_QUEUE_CAPACITY) | ||
|
|
||
| // Indicate if `start()` is called | ||
| private val started = new AtomicBoolean(false) | ||
|
|
@@ -96,11 +95,9 @@ private[spark] class LiveListenerBus extends SparkListenerBus { | |
| * listens for any additional events asynchronously while the listener bus is still running. | ||
| * This should only be called once. | ||
| * | ||
| * @param sc Used to stop the SparkContext in case the listener thread dies. | ||
| */ | ||
| def start(sc: SparkContext): Unit = { | ||
| def start(): Unit = { | ||
| if (started.compareAndSet(false, true)) { | ||
| sparkContext = sc | ||
| listenerThread.start() | ||
| } else { | ||
| throw new IllegalStateException(s"$name already started!") | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm modifying LiveListenerBus now and noticed that we're passing in
sparkContexteven though we only use it to accessconf. I think it would have been better to just pass inconfhere. It would make the initialization order constraints a lot clearer, too: right now it's not immediately clear whyeventQueueneeds to be alazy val.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.
I guess we also use this to tear down
sparkContextwhen the listener dies. I still have a weak preference for the old code, however, since I think the lifecycle was clearer.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.
From what I recall and as you mentioned, a ref to
sparkContextwas already being used to tear down when the listener died because of an uncaught Exception. The idea was to refactor the code to makesparkContextavailable at instantiation time and access the conf from it rather than passing it separately. This defn is cyclic andlazy valwas used to ensure that conf was accessed only after sc was intialized.