SparkUI is the web UI of a Spark application (aka Application UI).
SparkUI is created along with the following:
-
SparkContext (for a live Spark application with spark.ui.enabled configuration property enabled)
-
FsHistoryProvideris requested for the application UI (for a live or completed Spark application)
When created (while SparkContext is created for a live Spark application), SparkUI gets the following:
-
Live AppStatusStore (with a ElementTrackingStore using an InMemoryStore and a live AppStatusListener)
-
Name of the Spark application that is exactly the value of spark.app.name configuration property
-
Empty base path
When started, SparkUI binds to appUIAddress address that you can control using SPARK_PUBLIC_DNS environment variable or spark.driver.host Spark property.
|
Note
|
With spark.ui.killEnabled configuration property turned on, SparkUI allows to kill jobs and stages (subject to SecurityManager.checkModifyPermissions permissions).
|
SparkUI gets an AppStatusStore that is then used for the following:
-
Initializing tabs, i.e. JobsTab, StagesTab, StorageTab, EnvironmentTab
-
AbstractApplicationResourceis requested for jobsList, oneJob, executorList, allExecutorList, rddList, rddData, environmentInfo -
StagesResourceis requested for stageList, stageData, oneAttemptData, taskSummary, taskList -
SparkUIis requested for the current Spark user -
Creating Spark SQL’s
SQLTab(whenSQLHistoryServerPluginis requested tosetupUI) -
Spark Streaming’s
BatchPageis created
| Name | Description |
|---|---|
|
|
Tip
|
Enable Add the following line to Refer to Logging. |
setAppId(id: String): UnitsetAppId sets the internal appId.
|
Note
|
setAppId is used exclusively when SparkContext is initialized.
|
stop(): Unitstop stops the HTTP server and prints the following INFO message to the logs:
INFO SparkUI: Stopped Spark web UI at [appUIAddress]|
Note
|
appUIAddress in the above INFO message is the result of appUIAddress method.
|
appUIAddress: StringappUIAddress returns the entire URL of a Spark application’s web UI, including http:// scheme.
Internally, appUIAddress uses appUIHostPort.
getSparkUser: StringgetSparkUser returns the name of the user a Spark application runs as.
Internally, getSparkUser requests user.name System property from EnvironmentListener Spark listener.
|
Note
|
getSparkUser is used…FIXME
|
createLiveUI(
sc: SparkContext,
conf: SparkConf,
listenerBus: SparkListenerBus,
jobProgressListener: JobProgressListener,
securityManager: SecurityManager,
appName: String,
startTime: Long): SparkUIcreateLiveUI creates a SparkUI for a live running Spark application.
Internally, createLiveUI simply forwards the call to create.
|
Note
|
createLiveUI is called when SparkContext is created (and spark.ui.enabled is enabled).
|
appUIHostPort: StringappUIHostPort returns the Spark application’s web UI which is the public hostname and port, excluding the scheme.
|
Note
|
appUIAddress uses appUIHostPort and adds http:// scheme.
|
getAppName: StringgetAppName returns the name of the Spark application (of a SparkUI instance).
|
Note
|
getAppName is used when…FIXME
|
create(
sc: Option[SparkContext],
store: AppStatusStore,
conf: SparkConf,
securityManager: SecurityManager,
appName: String,
basePath: String = "",
startTime: Long,
appSparkVersion: String = org.apache.spark.SPARK_VERSION): SparkUIcreate creates a SparkUI backed by a AppStatusStore.
Internally, create simply creates a new SparkUI (with the predefined Spark version).
SparkUI takes the following when created:
SparkUI initializes the internal registries and counters and the tabs and handlers.
initialize(): Unit|
Note
|
initialize is part of WebUI Contract to initialize web components.
|
initialize creates and attaches the following tabs (with the reference to the SparkUI and its AppStatusStore):
In the end, initialize creates and attaches the following ServletContextHandlers:
-
Creates a static handler for serving files from a static directory, i.e.
/staticto serve static files fromorg/apache/spark/ui/staticdirectory (on CLASSPATH) -
Creates a redirect handler to redirect
/to/jobs/(and so the Jobs tab is the welcome tab when you open the web UI) -
Creates a redirect handler to redirect
/jobs/job/killto/jobs/and request theJobsTabto execute handleKillRequest before redirection -
Creates a redirect handler to redirect
/stages/stage/killto/stages/and request theStagesTabto execute handleKillRequest before redirection
