INFO SparkContext: Registered listener org.apache.spark.scheduler.StatsReportListener
Spark Listeners — Intercepting Events from Spark Scheduler
A SparkListener
intercepts events from the Spark scheduler that it emits over the course of execution of a Spark application.
A Spark listener is an implementation of the SparkListener
developer API that is an extension of SparkListenerInterface where all the callback methods are no-op/do-nothing.
Spark uses Spark listeners for web UI, event persistence (for History Server), dynamic allocation of executors and other services.
You can develop your own custom Spark listener using the SparkListener
developer API and register it using SparkContext.addSparkListener method or spark.extraListeners setting. With SparkListener
you can focus on Spark events of your liking and process a subset of scheduling events.
Tip
|
Developing a custom SparkListener is an excellent introduction to low-level details of Spark’s Execution Model. Check out the exercise Developing Custom SparkListener to monitor DAGScheduler in Scala. |
Tip
|
Enable |
SparkListenerInterface — Internal Contract for Spark Listeners
SparkListenerInterface
is an private[spark]
contract for Spark listeners to intercept events from the Spark scheduler.
Note
|
SparkListener and SparkFirehoseListener Spark listeners are direct implementations of SparkListenerInterface contract to help developing more sophisticated Spark listeners.
|
Method | Event | Reason |
---|---|---|
|
|
|
|
|
|
|
||
|
||
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
||
|
|
|
|
|
|
|
Built-In Spark Listeners
Spark Listener | Description |
---|---|
Logs JSON-encoded events to a file that can later be read by History Server |
|
Allows users to receive all SparkListenerEvent events by overriding the single |
|
Prepares information for Executors tab in web UI |
|
StorageStatusListener, RDDOperationGraphListener, EnvironmentListener, BlockStatusListener and StorageListener |
For web UI |
|
|
|
|
Support for History Server |
|