Skip to content

WebUI -- Base Web UI

WebUI is the <> of the <> in Apache Spark:

  • Active Spark applications

  • Spark History Server

  • Spark Standalone cluster manager

  • Spark on Mesos cluster manager

NOTE: Spark on YARN uses a different web framework for the web UI.

WebUI is used as the parent of[WebUITabs].

[[contract]] [source, scala]

package org.apache.spark.ui

abstract class WebUI { // only required methods that have no implementation // the others follow def initialize(): Unit }

NOTE: WebUI is a private[spark] contract.

.(Subset of) WebUI Contract [cols="1,2",options="header",width="100%"] |=== | Method | Description

| initialize a| [[initialize]] Used in <> only to let them initialize their web components

NOTE: initialize does not add anything special to the Scala type hierarchy but a common name to use across WebUIs (that could also be possible without it). In other words, initialize does not participate in any design pattern or a type hierarchy. |===

WebUI is a Scala abstract class and cannot be <> directly, but only as one of the <>.

[[implementations]] .WebUIs [cols="1,2",options="header",width="100%"] |=== | WebUI | Description

|[HistoryServer] | [[HistoryServer]] Used in Spark History Server

| MasterWebUI | [[MasterWebUI]] Used in Spark Standalone cluster manager

| MesosClusterUI | [[MesosClusterUI]] Used in Spark on Mesos cluster manager

|[SparkUI] | [[SparkUI]] WebUI of a Spark application

| WorkerWebUI | [[WorkerWebUI]] Used in Spark Standalone cluster manager |===

[[boundPort]] Once <>, WebUI is available at an HTTP port (and is used in the <> as boundPort).

[[webUrl]] WebUI is available at a web URL, i.e. http://[publicHostName]:[boundPort]. The <> is...FIXME and the <> is the port that the <>.

[[internal-registries]] .WebUI's Internal Properties (e.g. Registries, Counters and Flags) [cols="1,2",options="header",width="100%"] |=== | Name | Description

| tabs | [[tabs]][WebUITabs]

Used when...FIXME

| handlers | [[handlers]] ServletContextHandlers

Used when...FIXME

| pageToHandlers | [[pageToHandlers]] ServletContextHandlers per[WebUIPage]

Used when...FIXME

| serverInfo | [[serverInfo]] Optional ServerInfo (default: None)

Used when...FIXME

| publicHostName a| [[publicHostName]] Host name of the UI

publicHostName is either SPARK_PUBLIC_DNS environment variable or configuration property.

Defaults to the following if defined (in order):

. SPARK_LOCAL_HOSTNAME environment variable . Host name of SPARK_LOCAL_IP environment variable . Utils.findLocalInetAddress

Used exclusively when WebUI is requested for the <>

| className | [[className]]

Used when...FIXME |===

[[logging]] [TIP] ==== Enable INFO or ERROR logging level for the corresponding loggers of the <>, e.g. org.apache.spark.ui.SparkUI, to see what happens inside.

Add the following line to conf/

Refer to[Logging].

=== [[creating-instance]] Creating WebUI Instance

WebUI takes the following when created:

  • [[securityManager]] SecurityManager
  • [[sslOptions]] SSLOptions
  • [[port]] Port number
  • [[conf]][SparkConf]
  • [[basePath]] basePath (default: empty)
  • [[name]] Name (default: empty)

WebUI initializes the <>.

NOTE: WebUI is a Scala abstract class and cannot be created directly, but only as one of the <>.

=== [[detachPage]] Detaching Page And Associated Handlers from UI -- detachPage Method

[source, scala]

detachPage(page: WebUIPage): Unit


NOTE: detachPage is used when...FIXME

=== [[detachTab]] Detaching Tab And Associated Pages from UI -- detachTab Method

[source, scala]

detachTab(tab: WebUITab): Unit


NOTE: detachTab is used when...FIXME

=== [[detachHandler-ServletContextHandler]] Detaching Handler -- detachHandler Method

[source, scala]

detachHandler(handler: ServletContextHandler): Unit


NOTE: detachHandler is used when...FIXME

=== [[detachHandler-String]] Detaching Handler At Path -- detachHandler Method

[source, scala]

detachHandler(path: String): Unit


NOTE: detachHandler is used when...FIXME

=== [[attachPage]] Attaching Page to UI -- attachPage Method

[source, scala]

attachPage(page: WebUIPage): Unit

Internally, attachPage creates the path of the[WebUIPage] that is / (forward slash) followed by the[prefix] of the page.

attachPage[creates a HTTP request handler]...FIXME


attachPage is used when:

  • WebUI is requested to <> (the[WebUIPages] actually)

*[HistoryServer], Spark Standalone's MasterWebUI and WorkerWebUI, Spark on Mesos' MesosClusterUI are requested to initialize

=== [[attachTab]] Attaching Tab And Associated Pages to UI -- attachTab Method

[source, scala]

attachTab(tab: WebUITab): Unit

attachTab <> every WebUIPage of the input[WebUITab].

In the end, attachTab adds the input WebUITab to <>.

NOTE: attachTab is used when...FIXME

=== [[addStaticHandler]] Attaching Static Handler -- addStaticHandler Method

[source, scala]

addStaticHandler(resourceBase: String, path: String): Unit


NOTE: addStaticHandler is used when...FIXME

=== [[attachHandler]] Attaching Handler to UI -- attachHandler Method

[source, scala]

attachHandler(handler: ServletContextHandler): Unit

attachHandler simply adds the input Jetty ServletContextHandler to <> registry and requests the <> to addHandler (only if the ServerInfo is defined).

attachHandler is used when:

  • <> (i.e.[HistoryServer], Spark Standalone's MasterWebUI and WorkerWebUI, Spark on Mesos' MesosClusterUI,[SparkUI]) are requested to initialize

  • WebUI is requested to <> and <>

  • SparkContext is created

  • HistoryServer is requested to[attachSparkUI]

  • Spark Standalone's Master and Worker are requested to onStart (and attach their metrics servlet handlers to the web ui)

=== [[getBasePath]] getBasePath Method

[source, scala]

getBasePath: String

getBasePath simply returns the <>.

NOTE: getBasePath is used exclusively when WebUITab is requested for the[base path].

=== [[getTabs]] Requesting Header Tabs -- getTabs Method

[source, scala]

getTabs: Seq[WebUITab]

getTabs simply returns the <>.

NOTE: getTabs is used exclusively when WebUITab is requested for the[header tabs].

=== [[getHandlers]] Requesting Handlers -- getHandlers Method

[source, scala]

getHandlers: Seq[ServletContextHandler]

getHandlers simply returns the <>.

NOTE: getHandlers is used when...FIXME

=== [[bind]] Binding UI to Jetty HTTP Server on Host -- bind Method

[source, scala]

bind(): Unit


NOTE: bind is used when...FIXME

=== [[stop]] Stopping UI -- stop Method

[source, scala]

stop(): Unit


NOTE: stop is used when...FIXME

Last update: 2020-11-27