Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
841721e
SPARK-1352: Improve robustness of spark-submit script
pwendell Mar 31, 2014
5731af5
[SQL] Rewrite join implementation to allow streaming of one relation.
marmbrus Mar 31, 2014
33b3c2a
SPARK-1365 [HOTFIX] Fix RateLimitedOutputStream test
pwendell Mar 31, 2014
564f1c1
SPARK-1376. In the yarn-cluster submitter, rename "args" option to "arg"
sryza Apr 1, 2014
94fe7fd
[SPARK-1377] Upgrade Jetty to 8.1.14v20131031
andrewor14 Apr 1, 2014
ada310a
[Hot Fix #42] Persisted RDD disappears on storage page if re-used
andrewor14 Apr 1, 2014
f5c418d
[SQL] SPARK-1372 Support for caching and uncaching tables in a SQLCon…
marmbrus Apr 1, 2014
764353d
[SPARK-1342] Scala 2.10.4
markhamstra Apr 2, 2014
afb5ea6
[Spark-1134] only call ipython if no arguments are given; remove IPYT…
Apr 2, 2014
45df912
Revert "[Spark-1134] only call ipython if no arguments are given; rem…
mateiz Apr 2, 2014
8b3045c
MLI-1 Decision Trees
manishamde Apr 2, 2014
ea9de65
Remove * from test case golden filename.
marmbrus Apr 2, 2014
11973a7
Renamed stageIdToActiveJob to jobIdToActiveJob.
kayousterhout Apr 2, 2014
de8eefa
[SPARK-1385] Use existing code for JSON de/serialization of BlockId
andrewor14 Apr 2, 2014
7823633
Do not re-use objects in the EdgePartition/EdgeTriplet iterators.
darabos Apr 2, 2014
1faa579
[SPARK-1371][WIP] Compression support for Spark SQL in-memory columna…
liancheng Apr 2, 2014
ed730c9
StopAfter / TopK related changes
rxin Apr 2, 2014
9c65fa7
[SPARK-1212, Part II] Support sparse data in MLlib
mengxr Apr 2, 2014
47ebea5
[SQL] SPARK-1364 Improve datatype and test coverage for ScalaReflecti…
marmbrus Apr 3, 2014
92a86b2
[SPARK-1398] Removed findbugs jsr305 dependency
markhamstra Apr 3, 2014
fbebaed
Spark parquet improvements
AndreSchumacher Apr 3, 2014
5d1feda
[SPARK-1360] Add Timestamp Support for SQL
chenghao-intel Apr 3, 2014
c1ea3af
Spark 1162 Implemented takeOrdered in pyspark.
ScrapCodes Apr 3, 2014
b8f5341
[SQL] SPARK-1333 First draft of java API
marmbrus Apr 3, 2014
a599e43
[SPARK-1134] Fix and document passing of arguments to IPython
Apr 3, 2014
d94826b
[BUILD FIX] Fix compilation of Spark SQL Java API.
marmbrus Apr 3, 2014
9231b01
Fix jenkins from giving the green light to builds that don't compile.
marmbrus Apr 3, 2014
33e6361
Revert "[SPARK-1398] Removed findbugs jsr305 dependency"
pwendell Apr 4, 2014
ee6e9e7
SPARK-1337: Application web UI garbage collects newest stages
pwendell Apr 4, 2014
7f32fd4
SPARK-1350. Always use JAVA_HOME to run executor container JVMs.
sryza Apr 4, 2014
01cf4c4
SPARK-1404: Always upgrade spark-env.sh vars to environment vars
aarondav Apr 4, 2014
f1fa617
[SPARK-1133] Add whole text files reader in MLlib
yinxusen Apr 4, 2014
16b8308
SPARK-1375. Additional spark-submit cleanup
sryza Apr 4, 2014
a02b535
Don't create SparkContext in JobProgressListenerSuite.
pwendell Apr 4, 2014
198892f
[SPARK-1198] Allow pipes tasks to run in different sub-directories
tgravescs Apr 5, 2014
d956cc2
[SQL] Minor fixes.
marmbrus Apr 5, 2014
60e18ce
SPARK-1414. Python API for SparkContext.wholeTextFiles
mateiz Apr 5, 2014
5f3c1bb
Add test utility for generating Jar files with compiled classes.
pwendell Apr 5, 2014
1347ebd
[SPARK-1419] Bumped parent POM to apache 14
markhamstra Apr 5, 2014
b50ddfd
SPARK-1305: Support persisting RDD's directly to Tachyon
haoyuan Apr 5, 2014
8de038e
[SQL] SPARK-1366 Consistent sql function across different types of SQ…
marmbrus Apr 5, 2014
0acc7a0
small fix ( proogram -> program )
prabeesh Apr 5, 2014
7c18428
HOTFIX for broken CI, by SPARK-1336
ScrapCodes Apr 5, 2014
2d0150c
Remove the getStageInfo() method from SparkContext.
kayousterhout Apr 5, 2014
6e88583
[SPARK-1371] fix computePreferredLocations signature to not depend on…
Apr 5, 2014
890d63b
Fix for PR #195 for Java 6
srowen Apr 6, 2014
0b85516
SPARK-1421. Make MLlib work on Python 2.6
mateiz Apr 6, 2014
7012ffa
Fix SPARK-1420 The maven build error for Spark Catalyst
witgo Apr 6, 2014
e258e50
[SPARK-1259] Make RDD locally iterable
epahomov Apr 6, 2014
856c50f
SPARK-1387. Update build plugins, avoid plugin version warning, centr…
srowen Apr 7, 2014
7ce52c4
SPARK-1349: spark-shell gets its own command history
aarondav Apr 7, 2014
4106558
SPARK-1314: Use SPARK_HIVE to determine if we include Hive in packaging
aarondav Apr 7, 2014
1440154
SPARK-1154: Clean up app folders in worker nodes
Apr 7, 2014
87d0928
SPARK-1431: Allow merging conflicting pull requests
pwendell Apr 7, 2014
accd099
[SQL] SPARK-1371 Hash Aggregation Improvements
marmbrus Apr 7, 2014
b5bae84
[SQL] SPARK-1427 Fix toString for SchemaRDD NativeCommands.
marmbrus Apr 7, 2014
a3c51c6
SPARK-1432: Make sure that all metadata fields are properly cleaned
Apr 7, 2014
83f2a2f
[sql] Rename Expression.apply to eval for better readability.
rxin Apr 7, 2014
9dd8b91
SPARK-1252. On YARN, use container-log4j.properties for executors
sryza Apr 7, 2014
2a2ca48
HOTFIX: Disable actor input stream test.
pwendell Apr 7, 2014
0307db0
SPARK-1099: Introduce local[*] mode to infer number of cores
aarondav Apr 7, 2014
14c9238
[sql] Rename execution/aggregates.scala Aggregate.scala, and added a …
rxin Apr 8, 2014
55dfd5d
Removed the default eval implementation from Expression, and added a …
rxin Apr 8, 2014
31e6fff
Added eval for Rand (without any support for user-defined seed).
rxin Apr 8, 2014
f27e56a
Change timestamp cast semantics. When cast to numeric types, return t…
rxin Apr 8, 2014
0d0493f
[SPARK-1402] Added 3 more compression schemes
liancheng Apr 8, 2014
11eabbe
[SPARK-1103] Automatic garbage collection of RDD, shuffle and broadca…
tdas Apr 8, 2014
83ac9a4
[SPARK-1331] Added graceful shutdown to Spark Streaming
tdas Apr 8, 2014
6dc5f58
[SPARK-1396] Properly cleanup DAGScheduler on job cancellation.
kayousterhout Apr 8, 2014
3bc0548
Remove extra semicolon in import statement and unused import in Appli…
hsaputra Apr 8, 2014
a8d86b0
SPARK-1348 binding Master, Worker, and App Web UI to all interfaces
kanzhang Apr 8, 2014
e25b593
SPARK-1445: compute-classpath should not print error if lib_managed n…
aarondav Apr 8, 2014
fac6085
[SPARK-1397] Notify SparkListeners when stages fail or are cancelled.
kayousterhout Apr 8, 2014
12c077d
SPARK-1433: Upgrade Mesos dependency to 0.17.0
techaddict Apr 8, 2014
ce8ec54
Spark 1271: Co-Group and Group-By should pass Iterable[X]
holdenk Apr 9, 2014
b9e0c93
[SPARK-1434] [MLLIB] change labelParser from anonymous function to trait
mengxr Apr 9, 2014
fa0524f
Spark-939: allow user jars to take precedence over spark jars
holdenk Apr 9, 2014
9689b66
[SPARK-1390] Refactoring of matrices backed by RDDs
mengxr Apr 9, 2014
87bd1f9
SPARK-1093: Annotate developer and experimental API's
pwendell Apr 9, 2014
bde9cc1
[SPARK-1357] [MLLIB] Annotate developer and experimental APIs
mengxr Apr 9, 2014
eb5f2b6
SPARK-1407 drain event queue before stopping event logger
kanzhang Apr 9, 2014
0adc932
[SPARK-1357 (fix)] remove empty line after :: DeveloperApi/Experiment…
mengxr Apr 10, 2014
8ca3b2b
SPARK-729: Closures not always serialized at capture time
willb Apr 10, 2014
e55cc4b
SPARK-1446: Spark examples should not do a System.exit
techaddict Apr 10, 2014
e6d4a74
Revert "SPARK-729: Closures not always serialized at capture time"
pwendell Apr 10, 2014
a74fbbb
Fix SPARK-1413: Parquet messes up stdout and stdin when used in Spark…
witgo Apr 10, 2014
79820fe
[SPARK-1276] Add a HistoryServer to render persisted UI
andrewor14 Apr 10, 2014
3bd3129
SPARK-1428: MLlib should convert non-float64 NumPy arrays to float64 …
techaddict Apr 10, 2014
7b52b66
Revert "SPARK-1433: Upgrade Mesos dependency to 0.17.0"
pwendell Apr 10, 2014
f046662
Update tuning.md
ash211 Apr 10, 2014
930b70f
Remove Unnecessary Whitespace's
techaddict Apr 10, 2014
f99401a
[SQL] Improve column pruning in the optimizer.
marmbrus Apr 10, 2014
2c55783
SPARK-1202 - Add a "cancel" button in the UI for stages
Apr 11, 2014
5cd11d5
Set spark.executor.uri from environment variable (needed by Mesos)
ivanwick Apr 11, 2014
7b4203a
Add Spark v0.9.1 to ec2 launch script and use it as the default
harveyfeng Apr 11, 2014
44f654e
SPARK-1202: Improvements to task killing in the UI.
pwendell Apr 11, 2014
446bb34
SPARK-1417: Spark on Yarn - spark UI link from resourcemanager is broken
tgravescs Apr 11, 2014
98225a6
Some clean up in build/docs
pwendell Apr 11, 2014
f5ace8d
[SPARK-1225, 1241] [MLLIB] Add AreaUnderCurve and BinaryClassificatio…
mengxr Apr 11, 2014
6a0f8e3
HOTFIX: Ignore python metastore files in RAT checks.
pwendell Apr 11, 2014
7038b00
[FIX] make coalesce test deterministic in RDDSuite
mengxr Apr 12, 2014
fdfb45e
[WIP] [SPARK-1328] Add vector statistics
yinxusen Apr 12, 2014
aa8bb11
Update WindowedDStream.scala
baishuo Apr 12, 2014
165e06a
SPARK-1057 (alternative) Remove fastutil
srowen Apr 12, 2014
6aa08c3
[SPARK-1386] Web UI for Spark Streaming
tdas Apr 12, 2014
c2d160f
[Fix #204] Update out-dated comments
andrewor14 Apr 12, 2014
ca11919
[SPARK-1403] Move the class loader creation back to where it was in 0…
Apr 13, 2014
4bc07ee
SPARK-1480: Clean up use of classloaders
pwendell Apr 13, 2014
037fe4d
[SPARK-1415] Hadoop min split for wholeTextFiles()
yinxusen Apr 13, 2014
7dbca68
[BUGFIX] In-memory columnar storage bug fixes
liancheng Apr 14, 2014
268b535
HOTFIX: Use file name and not paths for excludes
pwendell Apr 14, 2014
0247b5c
SPARK-1488. Resolve scalac feature warnings during build
srowen Apr 15, 2014
c99bcb7
SPARK-1374: PySpark API for SparkSQL
ahirreddy Apr 15, 2014
df36091
SPARK-1426: Make MLlib work with NumPy versions older than 1.7
techaddict Apr 15, 2014
2580a3b
SPARK-1501: Ensure assertions in Graph.apply are asserted.
willb Apr 15, 2014
6843d63
[SPARK-1157][MLlib] L-BFGS Optimizer based on Breeze's implementation.
Apr 15, 2014
07d72fe
Decision Tree documentation for MLlib programming guide
manishamde Apr 15, 2014
5aaf983
SPARK-1455: Better isolation for unit tests.
pwendell Apr 16, 2014
8517911
[FIX] update sbt-idea to version 1.6.0
mengxr Apr 16, 2014
63ca581
[WIP] SPARK-1430: Support sparse data in Python MLlib
mateiz Apr 16, 2014
273c2fd
[SQL] SPARK-1424 Generalize insertIntoTable functions on SchemaRDDs
marmbrus Apr 16, 2014
6a10d80
[SPARK-959] Updated SBT from 0.13.1 to 0.13.2
liancheng Apr 16, 2014
c0273d8
Make "spark logo" link refer to "/".
Apr 16, 2014
fec462c
Loads test tables when running "sbt hive/console" without HIVE_DEV_HOME
liancheng Apr 16, 2014
9edd887
update spark.default.parallelism
CrazyJvm Apr 16, 2014
c3527a3
SPARK-1310: Start adding k-fold cross validation to MLLib [adds kFold…
holdenk Apr 16, 2014
77f8367
SPARK-1497. Fix scalastyle warnings in YARN, Hive code
srowen Apr 16, 2014
82349fb
Minor addition to SPARK-1497
pwendell Apr 16, 2014
e269c24
SPARK-1469: Scheduler mode should accept lower-case definitions and h…
techaddict Apr 16, 2014
725925c
SPARK-1465: Spark compilation is broken with the latest hadoop-2.4.0 …
Apr 16, 2014
10b1c59
[SPARK-1511] use Files.move instead of renameTo in TestUtils.scala
advancedxy Apr 16, 2014
987760e
Add clean to build
pwendell Apr 16, 2014
235a47c
Rebuild routing table after Graph.reverse
ankurdave Apr 17, 2014
17d3234
SPARK-1329: Create pid2vid with correct number of partitions
ankurdave Apr 17, 2014
016a877
remove unnecessary brace and semicolon in 'putBlockInfo.synchronize' …
CrazyJvm Apr 17, 2014
38877cc
Fixing a race condition in event listener unit test
kanzhang Apr 17, 2014
9c40b9e
misleading task number of groupByKey
CrazyJvm Apr 17, 2014
07b7ad3
Update ReducedWindowedDStream.scala
baishuo Apr 17, 2014
d4916a8
Include stack trace for exceptions thrown by user code.
marmbrus Apr 17, 2014
6ad4c54
SPARK-1462: Examples of ML algorithms are using deprecated APIs
techaddict Apr 17, 2014
bb76eae
[python alternative] pyspark require Python2, failing if system defau…
abhishekkr Apr 17, 2014
6904750
[SPARK-1395] Allow "local:" URIs to work on Yarn.
Apr 17, 2014
0058b5d
SPARK-1408 Modify Spark on Yarn to point to the history server when a…
tgravescs Apr 17, 2014
6c746ba
FIX: Don't build Hive in assembly unless running Hive tests.
pwendell Apr 18, 2014
7863ecc
HOTFIX: Ignore streaming UI test
pwendell Apr 18, 2014
e31c8ff
SPARK-1483: Rename minSplits to minPartitions in public APIs
CodingCat Apr 18, 2014
89f4743
Reuses Row object in ExistingRdd.productToRowRdd()
liancheng Apr 18, 2014
aa17f02
[SPARK-1520] remove fastutil from dependencies
mengxr Apr 18, 2014
8aa1f4c
SPARK-1357 (addendum). More Experimental items in MLlib
srowen Apr 18, 2014
3c7a9ba
SPARK-1523: improve the readability of code in AkkaUtil
CodingCat Apr 18, 2014
81a152c
Fixed broken pyspark shell.
rxin Apr 18, 2014
c399baa
SPARK-1456 Remove view bounds on Ordered in favor of a context bound …
marmbrus Apr 18, 2014
2089e0e
SPARK-1482: Fix potential resource leaks in saveAsHadoopDataset and s…
zsxwing Apr 19, 2014
28238c8
README update
rxin Apr 19, 2014
5d0f58b
Use scala deprecation instead of java.
marmbrus Apr 19, 2014
10d0421
Add insertInto and saveAsTable to Python API.
marmbrus Apr 19, 2014
25fc318
[SPARK-1535] ALS: Avoid the garbage-creating ctor of DoubleMatrix
tmyklebu Apr 19, 2014
3a390bf
REPL cleanup.
marmbrus Apr 20, 2014
42238b6
Fix org.scala-lang: * inconsistent versions for maven
witgo Apr 21, 2014
b434ec0
remove exclusion scalap
witgo Apr 21, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[SPARK-1386] Web UI for Spark Streaming
When debugging Spark Streaming applications it is necessary to monitor certain metrics that are not shown in the Spark application UI. For example, what is average processing time of batches? What is the scheduling delay? Is the system able to process as fast as it is receiving data? How many records I am receiving through my receivers?

While the StreamingListener interface introduced in the 0.9 provided some of this information, it could only be accessed programmatically. A UI that shows information specific to the streaming applications is necessary for easier debugging. This PR introduces such a UI. It shows various statistics related to the streaming application. Here is a screenshot of the UI running on my local machine.

http://i.imgur.com/1ooDGhm.png

This UI is integrated into the Spark UI running at 4040.

Author: Tathagata Das <[email protected]>
Author: Andrew Or <[email protected]>

Closes #290 from tdas/streaming-web-ui and squashes the following commits:

fc73ca5 [Tathagata Das] Merge pull request #9 from andrewor14/ui-refactor
642dd88 [Andrew Or] Merge SparkUISuite.scala into UISuite.scala
eb30517 [Andrew Or] Merge github.com:apache/spark into ui-refactor
f4f4cbe [Tathagata Das] More minor fixes.
34bb364 [Tathagata Das] Merge branch 'streaming-web-ui' of github.com:tdas/spark into streaming-web-ui
252c566 [Tathagata Das] Merge pull request #8 from andrewor14/ui-refactor
e038b4b [Tathagata Das] Addressed Patrick's comments.
125a054 [Andrew Or] Disable serving static resources with gzip
90feb8d [Andrew Or] Address Patrick's comments
89dae36 [Tathagata Das] Merge branch 'streaming-web-ui' of github.com:tdas/spark into streaming-web-ui
72fe256 [Tathagata Das] Merge pull request #6 from andrewor14/ui-refactor
2fc09c8 [Tathagata Das] Added binary check exclusions
aa396d4 [Andrew Or] Rename tabs and pages (No more IndexPage.scala)
f8e1053 [Tathagata Das] Added Spark and Streaming UI unit tests.
caa5e05 [Tathagata Das] Merge branch 'streaming-web-ui' of github.com:tdas/spark into streaming-web-ui
585cd65 [Tathagata Das] Merge pull request #5 from andrewor14/ui-refactor
914b8ff [Tathagata Das] Moved utils functions to UIUtils.
548c98c [Andrew Or] Wide refactoring of WebUI, UITab, and UIPage (see commit message)
6de06b0 [Tathagata Das] Merge remote-tracking branch 'apache/master' into streaming-web-ui
ee6543f [Tathagata Das] Minor changes based on Andrew's comments.
fa760fe [Tathagata Das] Fixed long line.
1c0bcef [Tathagata Das] Refactored streaming UI into two files.
1af239b [Tathagata Das] Changed streaming UI to attach itself as a tab with the Spark UI.
827e81a [Tathagata Das] Merge branch 'streaming-web-ui' of github.com:tdas/spark into streaming-web-ui
168fe86 [Tathagata Das] Merge pull request #2 from andrewor14/ui-refactor
3e986f8 [Tathagata Das] Merge remote-tracking branch 'apache/master' into streaming-web-ui
c78c92d [Andrew Or] Remove outdated comment
8f7323b [Andrew Or] End of file new lines, indentation, and imports (minor)
0d61ee8 [Andrew Or] Merge branch 'streaming-web-ui' of github.com:tdas/spark into ui-refactor
9a48fa1 [Andrew Or] Allow adding tabs to SparkUI dynamically + add example
61358e3 [Tathagata Das] Merge remote-tracking branch 'apache-github/master' into streaming-web-ui
53be2c5 [Tathagata Das] Minor style updates.
ed25dfc [Andrew Or] Generalize SparkUI header to display tabs dynamically
a37ad4f [Andrew Or] Comments, imports and formatting (minor)
cd000b0 [Andrew Or] Merge github.com:apache/spark into ui-refactor
7d57444 [Andrew Or] Refactoring the UI interface to add flexibility
aef4dd5 [Tathagata Das] Added Apache licenses.
db27bad [Tathagata Das] Added last batch processing time to StreamingUI.
4d86e98 [Tathagata Das] Added basic stats to the StreamingUI and refactored the UI to a Page to make it easier to transition to using SparkUI later.
93f1c69 [Tathagata Das] Added network receiver information to the Streaming UI.
56cc7fb [Tathagata Das] First cut implementation of Streaming UI.
  • Loading branch information
tdas authored and pwendell committed Apr 12, 2014
commit 6aa08c39cf30fa5c4ed97f4fff16371b9030a2e6
1 change: 0 additions & 1 deletion core/src/main/scala/org/apache/spark/SparkContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ class SparkContext(config: SparkConf) extends Logging {
// Initialize the Spark UI, registering all associated listeners
private[spark] val ui = new SparkUI(this)
ui.bind()
ui.start()

// Optionally log Spark events
private[spark] val eventLogger: Option[EventLoggingListener] = {
Expand Down
50 changes: 0 additions & 50 deletions core/src/main/scala/org/apache/spark/deploy/SparkUIContainer.scala

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import javax.servlet.http.HttpServletRequest

import scala.xml.Node

import org.apache.spark.ui.{UIUtils, WebUI}
import org.apache.spark.ui.{WebUIPage, UIUtils}

private[spark] class IndexPage(parent: HistoryServer) {
private[spark] class HistoryPage(parent: HistoryServer) extends WebUIPage("") {

def render(request: HttpServletRequest): Seq[Node] = {
val appRows = parent.appIdToInfo.values.toSeq.sortBy { app => -app.lastUpdated }
Expand Down Expand Up @@ -62,13 +62,13 @@ private[spark] class IndexPage(parent: HistoryServer) {
private def appRow(info: ApplicationHistoryInfo): Seq[Node] = {
val appName = if (info.started) info.name else info.logDirPath.getName
val uiAddress = parent.getAddress + info.ui.basePath
val startTime = if (info.started) WebUI.formatDate(info.startTime) else "Not started"
val endTime = if (info.completed) WebUI.formatDate(info.endTime) else "Not completed"
val startTime = if (info.started) UIUtils.formatDate(info.startTime) else "Not started"
val endTime = if (info.completed) UIUtils.formatDate(info.endTime) else "Not completed"
val difference = if (info.started && info.completed) info.endTime - info.startTime else -1L
val duration = if (difference > 0) WebUI.formatDuration(difference) else "---"
val duration = if (difference > 0) UIUtils.formatDuration(difference) else "---"
val sparkUser = if (info.started) info.sparkUser else "Unknown user"
val logDirectory = info.logDirPath.getName
val lastUpdated = WebUI.formatDate(info.lastUpdated)
val lastUpdated = UIUtils.formatDate(info.lastUpdated)
<tr>
<td><a href={uiAddress}>{appName}</a></td>
<td>{startTime}</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,13 @@

package org.apache.spark.deploy.history

import javax.servlet.http.HttpServletRequest

import scala.collection.mutable

import org.apache.hadoop.fs.{FileStatus, Path}
import org.eclipse.jetty.servlet.ServletContextHandler

import org.apache.spark.{Logging, SecurityManager, SparkConf}
import org.apache.spark.deploy.SparkUIContainer
import org.apache.spark.scheduler._
import org.apache.spark.ui.SparkUI
import org.apache.spark.ui.{WebUI, SparkUI}
import org.apache.spark.ui.JettyUtils._
import org.apache.spark.util.Utils

Expand All @@ -46,17 +42,15 @@ import org.apache.spark.util.Utils
*/
class HistoryServer(
val baseLogDir: String,
securityManager: SecurityManager,
conf: SparkConf)
extends SparkUIContainer("History Server") with Logging {
extends WebUI(securityManager, HistoryServer.WEB_UI_PORT, conf) with Logging {

import HistoryServer._

private val fileSystem = Utils.getHadoopFileSystem(baseLogDir)
private val localHost = Utils.localHostName()
private val publicHost = Option(System.getenv("SPARK_PUBLIC_DNS")).getOrElse(localHost)
private val port = WEB_UI_PORT
private val securityManager = new SecurityManager(conf)
private val indexPage = new IndexPage(this)

// A timestamp of when the disk was last accessed to check for log updates
private var lastLogCheckTime = -1L
Expand Down Expand Up @@ -90,37 +84,23 @@ class HistoryServer(
}
}

private val handlers = Seq[ServletContextHandler](
createStaticHandler(STATIC_RESOURCE_DIR, "/static"),
createServletHandler("/",
(request: HttpServletRequest) => indexPage.render(request), securityMgr = securityManager)
)

// A mapping of application ID to its history information, which includes the rendered UI
val appIdToInfo = mutable.HashMap[String, ApplicationHistoryInfo]()

initialize()

/**
* Start the history server.
* Initialize the history server.
*
* This starts a background thread that periodically synchronizes information displayed on
* this UI with the event logs in the provided base directory.
*/
def start() {
def initialize() {
attachPage(new HistoryPage(this))
attachHandler(createStaticHandler(STATIC_RESOURCE_DIR, "/static"))
logCheckingThread.start()
}

/** Bind to the HTTP server behind this web interface. */
override def bind() {
try {
serverInfo = Some(startJettyServer("0.0.0.0", port, handlers, conf))
logInfo("Started HistoryServer at http://%s:%d".format(publicHost, boundPort))
} catch {
case e: Exception =>
logError("Failed to bind HistoryServer", e)
System.exit(1)
}
}

/**
* Check for any updates to event logs in the base directory. This is only effective once
* the server has been bound.
Expand Down Expand Up @@ -151,7 +131,7 @@ class HistoryServer(
// Remove any applications that should no longer be retained
appIdToInfo.foreach { case (appId, info) =>
if (!retainedAppIds.contains(appId)) {
detachUI(info.ui)
detachSparkUI(info.ui)
appIdToInfo.remove(appId)
}
}
Expand Down Expand Up @@ -186,15 +166,14 @@ class HistoryServer(
val path = logDir.getPath
val appId = path.getName
val replayBus = new ReplayListenerBus(logInfo.logPaths, fileSystem, logInfo.compressionCodec)
val ui = new SparkUI(replayBus, appId, "/history/" + appId)
val appListener = new ApplicationEventListener
replayBus.addListener(appListener)
val ui = new SparkUI(conf, replayBus, appId, "/history/" + appId)

// Do not call ui.bind() to avoid creating a new server for each application
ui.start()
replayBus.replay()
if (appListener.applicationStarted) {
attachUI(ui)
attachSparkUI(ui)
val appName = appListener.appName
val sparkUser = appListener.sparkUser
val startTime = appListener.startTime
Expand All @@ -213,6 +192,18 @@ class HistoryServer(
fileSystem.close()
}

/** Attach a reconstructed UI to this server. Only valid after bind(). */
private def attachSparkUI(ui: SparkUI) {
assert(serverInfo.isDefined, "HistoryServer must be bound before attaching SparkUIs")
ui.getHandlers.foreach(attachHandler)
}

/** Detach a reconstructed UI from this server. Only valid after bind(). */
private def detachSparkUI(ui: SparkUI) {
assert(serverInfo.isDefined, "HistoryServer must be bound before detaching SparkUIs")
ui.getHandlers.foreach(detachHandler)
}

/** Return the address of this server. */
def getAddress: String = "http://" + publicHost + ":" + boundPort

Expand Down Expand Up @@ -262,9 +253,9 @@ object HistoryServer {

def main(argStrings: Array[String]) {
val args = new HistoryServerArguments(argStrings)
val server = new HistoryServer(args.logDir, conf)
val securityManager = new SecurityManager(conf)
val server = new HistoryServer(args.logDir, securityManager, conf)
server.bind()
server.start()

// Wait until the end of the world... or if the HistoryServer process is manually stopped
while(true) { Thread.sleep(Int.MaxValue) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ private[spark] class Master(
if (completedApps.size >= RETAINED_APPLICATIONS) {
val toRemove = math.max(RETAINED_APPLICATIONS / 10, 1)
completedApps.take(toRemove).foreach( a => {
appIdToUI.remove(a.id).foreach { ui => webUi.detachUI(ui) }
appIdToUI.remove(a.id).foreach { ui => webUi.detachSparkUI(ui) }
applicationMetricsSystem.removeSource(a.appSource)
})
completedApps.trimStart(toRemove)
Expand Down Expand Up @@ -667,12 +667,12 @@ private[spark] class Master(
if (!eventLogPaths.isEmpty) {
try {
val replayBus = new ReplayListenerBus(eventLogPaths, fileSystem, compressionCodec)
val ui = new SparkUI(replayBus, appName + " (completed)", "/history/" + app.id)
ui.start()
val ui = new SparkUI(
new SparkConf, replayBus, appName + " (completed)", "/history/" + app.id)
replayBus.replay()
app.desc.appUiUrl = ui.basePath
appIdToUI(app.id) = ui
webUi.attachUI(ui)
webUi.attachSparkUI(ui)
return true
} catch {
case t: Throwable =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@ import org.json4s.JValue
import org.apache.spark.deploy.JsonProtocol
import org.apache.spark.deploy.DeployMessages.{MasterStateResponse, RequestMasterState}
import org.apache.spark.deploy.master.ExecutorInfo
import org.apache.spark.ui.UIUtils
import org.apache.spark.ui.{WebUIPage, UIUtils}
import org.apache.spark.util.Utils

private[spark] class ApplicationPage(parent: MasterWebUI) {
val master = parent.masterActorRef
val timeout = parent.timeout
private[spark] class ApplicationPage(parent: MasterWebUI) extends WebUIPage("app") {

private val master = parent.masterActorRef
private val timeout = parent.timeout

/** Executor details for a particular application */
def renderJson(request: HttpServletRequest): JValue = {
override def renderJson(request: HttpServletRequest): JValue = {
val appId = request.getParameter("appId")
val stateFuture = (master ? RequestMasterState)(timeout).mapTo[MasterStateResponse]
val state = Await.result(stateFuture, timeout)
Expand Down Expand Up @@ -96,7 +97,7 @@ private[spark] class ApplicationPage(parent: MasterWebUI) {
UIUtils.basicSparkPage(content, "Application: " + app.desc.name)
}

def executorRow(executor: ExecutorInfo): Seq[Node] = {
private def executorRow(executor: ExecutorInfo): Seq[Node] = {
<tr>
<td>{executor.id}</td>
<td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ import scala.xml.Node
import akka.pattern.ask
import org.json4s.JValue

import org.apache.spark.deploy.{JsonProtocol}
import org.apache.spark.deploy.JsonProtocol
import org.apache.spark.deploy.DeployMessages.{MasterStateResponse, RequestMasterState}
import org.apache.spark.deploy.master.{ApplicationInfo, DriverInfo, WorkerInfo}
import org.apache.spark.ui.{WebUI, UIUtils}
import org.apache.spark.ui.{WebUIPage, UIUtils}
import org.apache.spark.util.Utils

private[spark] class IndexPage(parent: MasterWebUI) {
val master = parent.masterActorRef
val timeout = parent.timeout
private[spark] class MasterPage(parent: MasterWebUI) extends WebUIPage("") {
private val master = parent.masterActorRef
private val timeout = parent.timeout

def renderJson(request: HttpServletRequest): JValue = {
override def renderJson(request: HttpServletRequest): JValue = {
val stateFuture = (master ? RequestMasterState)(timeout).mapTo[MasterStateResponse]
val state = Await.result(stateFuture, timeout)
JsonProtocol.writeMasterState(state)
Expand Down Expand Up @@ -139,7 +139,7 @@ private[spark] class IndexPage(parent: MasterWebUI) {
UIUtils.basicSparkPage(content, "Spark Master at " + state.uri)
}

def workerRow(worker: WorkerInfo): Seq[Node] = {
private def workerRow(worker: WorkerInfo): Seq[Node] = {
<tr>
<td>
<a href={worker.webUiAddress}>{worker.id}</a>
Expand All @@ -154,8 +154,7 @@ private[spark] class IndexPage(parent: MasterWebUI) {
</tr>
}


def appRow(app: ApplicationInfo): Seq[Node] = {
private def appRow(app: ApplicationInfo): Seq[Node] = {
<tr>
<td>
<a href={"app?appId=" + app.id}>{app.id}</a>
Expand All @@ -169,14 +168,14 @@ private[spark] class IndexPage(parent: MasterWebUI) {
<td sorttable_customkey={app.desc.memoryPerSlave.toString}>
{Utils.megabytesToString(app.desc.memoryPerSlave)}
</td>
<td>{WebUI.formatDate(app.submitDate)}</td>
<td>{UIUtils.formatDate(app.submitDate)}</td>
<td>{app.desc.user}</td>
<td>{app.state.toString}</td>
<td>{WebUI.formatDuration(app.duration)}</td>
<td>{UIUtils.formatDuration(app.duration)}</td>
</tr>
}

def driverRow(driver: DriverInfo): Seq[Node] = {
private def driverRow(driver: DriverInfo): Seq[Node] = {
<tr>
<td>{driver.id} </td>
<td>{driver.submitDate}</td>
Expand Down
Loading