Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
7e9f1ed0
Commit
7e9f1ed0
authored
11 years ago
by
Patrick Wendell
Browse files
Options
Downloads
Patches
Plain Diff
Some cleanup of styling
parent
3b7ebdee
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/src/main/scala/spark/ui/JettyUtils.scala
+32
-13
32 additions, 13 deletions
core/src/main/scala/spark/ui/JettyUtils.scala
core/src/main/scala/spark/ui/SparkUI.scala
+3
-1
3 additions, 1 deletion
core/src/main/scala/spark/ui/SparkUI.scala
with
35 additions
and
14 deletions
core/src/main/scala/spark/ui/JettyUtils.scala
+
32
−
13
View file @
7e9f1ed0
...
@@ -41,11 +41,25 @@ private[spark] object JettyUtils extends Logging {
...
@@ -41,11 +41,25 @@ private[spark] object JettyUtils extends Logging {
response
.
setStatus
(
HttpServletResponse
.
SC_OK
)
response
.
setStatus
(
HttpServletResponse
.
SC_OK
)
baseRequest
.
setHandled
(
true
)
baseRequest
.
setHandled
(
true
)
val
result
=
responder
(
request
)
val
result
=
responder
(
request
)
response
.
setHeader
(
"Cache-Control"
,
"no-cache, no-store, must-revalidate"
)
response
.
getWriter
().
println
(
extractFn
(
result
))
response
.
getWriter
().
println
(
extractFn
(
result
))
}
}
}
}
}
}
def
createRedirectHandler
(
newPath
:
String
)
:
Handler
=
{
new
AbstractHandler
{
def
handle
(
target
:
String
,
baseRequest
:
Request
,
request
:
HttpServletRequest
,
response
:
HttpServletResponse
)
{
response
.
setStatus
(
302
)
response
.
setHeader
(
"Location"
,
baseRequest
.
getRootURL
+
newPath
)
baseRequest
.
setHandled
(
true
)
}
}
}
/** Creates a handler for serving files from a static directory. */
/** Creates a handler for serving files from a static directory. */
def
createStaticHandler
(
resourceBase
:
String
)
:
ResourceHandler
=
{
def
createStaticHandler
(
resourceBase
:
String
)
:
ResourceHandler
=
{
val
staticHandler
=
new
ResourceHandler
val
staticHandler
=
new
ResourceHandler
...
@@ -66,13 +80,9 @@ private[spark] object JettyUtils extends Logging {
...
@@ -66,13 +80,9 @@ private[spark] object JettyUtils extends Logging {
*/
*/
def
startJettyServer
(
ip
:
String
,
port
:
Int
,
handlers
:
Seq
[(
String
,
Handler
)])
:
(
Server
,
Int
)
=
{
def
startJettyServer
(
ip
:
String
,
port
:
Int
,
handlers
:
Seq
[(
String
,
Handler
)])
:
(
Server
,
Int
)
=
{
val
handlersToRegister
=
handlers
.
map
{
case
(
path
,
handler
)
=>
val
handlersToRegister
=
handlers
.
map
{
case
(
path
,
handler
)
=>
if
(
path
==
"*"
)
{
val
contextHandler
=
new
ContextHandler
(
path
)
handler
contextHandler
.
setHandler
(
handler
)
}
else
{
contextHandler
.
asInstanceOf
[
org.eclipse.jetty.server.Handler
]
val
contextHandler
=
new
ContextHandler
(
path
)
contextHandler
.
setHandler
(
handler
)
contextHandler
.
asInstanceOf
[
org.eclipse.jetty.server.Handler
]
}
}
}
val
handlerList
=
new
HandlerList
val
handlerList
=
new
HandlerList
...
@@ -99,13 +109,21 @@ object UIUtils {
...
@@ -99,13 +109,21 @@ object UIUtils {
/** Returns a page containing the supplied content and the spark web ui headers */
/** Returns a page containing the supplied content and the spark web ui headers */
def
headerSparkPage
(
content
:
=>
Seq
[
Node
],
sc
:
SparkContext
,
title
:
String
)
:
Seq
[
Node
]
=
{
def
headerSparkPage
(
content
:
=>
Seq
[
Node
],
sc
:
SparkContext
,
title
:
String
)
:
Seq
[
Node
]
=
{
val
newContent
=
val
newContent
=
<
div
class
=
"row"
>
<
div
class
=
"row"
style
=
"padding-top: 5px;"
>
<
div
class
=
"span12"
>
<
div
class
=
"span2"
>
<
div
style
=
"padding-left: 10px"
>
<
ul
class
=
"unstyled"
>
<
li
><
a
href
=
"/storage"
>
Storage
</
a
></
li
>
<
li
><
a
href
=
"/jobs"
>
Jobs
</
a
></
li
>
</
ul
>
</
div
>
</
div
>
<
div
class
=
"span10"
>
<
ul
class
=
"unstyled"
>
<
ul
class
=
"unstyled"
>
<
li
><
strong
>
Master
:</
strong
>
{
sc
.
master
}</
li
>
<
li
><
strong
>
Master
:</
strong
>
{
sc
.
master
}</
li
>
<
li
><
strong
>
Application
:</
strong
>
{
sc
.
appName
}</
li
>
<
li
><
strong
>
Application
:</
strong
>
{
sc
.
appName
}</
li
>
<
li
><
strong
>
Executors
:</
strong
>
{
sc
.
getExecutorStorageStatus
.
size
}
</
li
>
</
ul
>
</
ul
>
<
h3
><
a
href
=
"/storage"
>
Storage
</
a
>
|
<
a
href
=
"/stages"
>
Jobs
</
a
>
</
h3
>
</
div
>
</
div
>
</
div
>
</
div
>
<
hr
/>;
<
hr
/>;
...
@@ -128,10 +146,11 @@ object UIUtils {
...
@@ -128,10 +146,11 @@ object UIUtils {
<
body
>
<
body
>
<
div
class
=
"container"
>
<
div
class
=
"container"
>
<
div
class
=
"row"
>
<
div
class
=
"row"
>
<
div
class
=
"span
1
2"
>
<
div
class
=
"span2"
>
<
img
src
=
"/static/spark_logo.png"
/>
<
img
src
=
"/static/spark_logo.png"
/>
<
h1
style
=
"vertical-align: bottom; margin-bottom: 10px;
</
div
>
margin-left: 30px; display: inline-block;"
>
<
div
class
=
"span10"
>
<
h1
style
=
"vertical-align: bottom; margin-top: 40px; display: inline-block;"
>
{
title
}
{
title
}
</
h1
>
</
h1
>
</
div
>
</
div
>
...
...
This diff is collapsed.
Click to expand it.
core/src/main/scala/spark/ui/SparkUI.scala
+
3
−
1
View file @
7e9f1ed0
...
@@ -12,13 +12,15 @@ import spark.ui.JettyUtils._
...
@@ -12,13 +12,15 @@ import spark.ui.JettyUtils._
/** Top level user interface for Spark */
/** Top level user interface for Spark */
private
[
spark
]
class
SparkUI
(
sc
:
SparkContext
)
extends
Logging
{
private
[
spark
]
class
SparkUI
(
sc
:
SparkContext
)
extends
Logging
{
// TODO(pwendell): It would be nice to add a view that prints out environment information
val
host
=
Utils
.
localHostName
()
val
host
=
Utils
.
localHostName
()
val
port
=
Option
(
System
.
getProperty
(
"spark.ui.port"
)).
getOrElse
(
SparkUI
.
DEFAULT_PORT
).
toInt
val
port
=
Option
(
System
.
getProperty
(
"spark.ui.port"
)).
getOrElse
(
SparkUI
.
DEFAULT_PORT
).
toInt
var
boundPort
:
Option
[
Int
]
=
None
var
boundPort
:
Option
[
Int
]
=
None
val
handlers
=
Seq
[(
String
,
Handler
)](
val
handlers
=
Seq
[(
String
,
Handler
)](
(
"/static"
,
createStaticHandler
(
SparkUI
.
STATIC_RESOURCE_DIR
)),
(
"/static"
,
createStaticHandler
(
SparkUI
.
STATIC_RESOURCE_DIR
)),
(
"
*
"
,
(
re
quest
:
HttpServletRequest
)
=>
headerSparkPage
(<
h1
>
Test
</
h1
>,
sc
,
"Test p
age"
))
(
"
/
"
,
c
re
ateRedirectHandler
(
"/st
age
s
"
))
)
)
val
storage
=
new
BlockManagerUI
(
sc
)
val
storage
=
new
BlockManagerUI
(
sc
)
val
jobs
=
new
JobProgressUI
(
sc
)
val
jobs
=
new
JobProgressUI
(
sc
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment