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
77c69ae5
Commit
77c69ae5
authored
11 years ago
by
Matei Zaharia
Browse files
Options
Downloads
Plain Diff
Merge pull request #697 from pwendell/block-locations
Show block locations in Web UI.
parents
5a7835c1
08150f19
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/src/main/scala/spark/storage/StorageUtils.scala
+9
-2
9 additions, 2 deletions
core/src/main/scala/spark/storage/StorageUtils.scala
core/src/main/scala/spark/ui/storage/RDDPage.scala
+13
-4
13 additions, 4 deletions
core/src/main/scala/spark/ui/storage/RDDPage.scala
with
22 additions
and
6 deletions
core/src/main/scala/spark/storage/StorageUtils.scala
+
9
−
2
View file @
77c69ae5
...
...
@@ -39,12 +39,19 @@ case class RDDInfo(id: Int, name: String, storageLevel: StorageLevel,
private
[
spark
]
object
StorageUtils
{
/*
Given the current storage status of the BlockManager, returns information for each RDD
*/
def
rddInfoFromStorageStatus
(
storageStatusList
:
Array
[
StorageStatus
],
/*
Returns RDD-level information, compiled from a list of StorageStatus objects
*/
def
rddInfoFromStorageStatus
(
storageStatusList
:
Seq
[
StorageStatus
],
sc
:
SparkContext
)
:
Array
[
RDDInfo
]
=
{
rddInfoFromBlockStatusList
(
storageStatusList
.
flatMap
(
_
.
blocks
).
toMap
,
sc
)
}
/* Returns a map of blocks to their locations, compiled from a list of StorageStatus objects */
def
blockLocationsFromStorageStatus
(
storageStatusList
:
Seq
[
StorageStatus
])
=
{
val
blockLocationPairs
=
storageStatusList
.
flatMap
(
s
=>
s
.
blocks
.
map
(
b
=>
(
b
.
_1
,
s
.
blockManagerId
.
hostPort
)))
blockLocationPairs
.
groupBy
(
_
.
_1
).
map
{
case
(
k
,
v
)
=>
(
k
,
v
.
unzip
.
_2
)}.
toMap
}
/* Given a list of BlockStatus objets, returns information for each RDD */
def
rddInfoFromBlockStatusList
(
infos
:
Map
[
String
,
BlockStatus
],
sc
:
SparkContext
)
:
Array
[
RDDInfo
]
=
{
...
...
This diff is collapsed.
Click to expand it.
core/src/main/scala/spark/ui/storage/RDDPage.scala
+
13
−
4
View file @
77c69ae5
...
...
@@ -26,8 +26,14 @@ private[spark] class RDDPage(parent: BlockManagerUI) {
val
workers
=
filteredStorageStatusList
.
map
((
prefix
,
_
))
val
workerTable
=
listingTable
(
workerHeaders
,
workerRow
,
workers
)
val
blockHeaders
=
Seq
(
"Block Name"
,
"Storage Level"
,
"Size in Memory"
,
"Size on Disk"
)
val
blocks
=
filteredStorageStatusList
.
flatMap
(
_
.
blocks
).
toArray
.
sortWith
(
_
.
_1
<
_
.
_1
)
val
blockHeaders
=
Seq
(
"Block Name"
,
"Storage Level"
,
"Size in Memory"
,
"Size on Disk"
,
"Locations"
)
val
blockStatuses
=
filteredStorageStatusList
.
flatMap
(
_
.
blocks
).
toArray
.
sortWith
(
_
.
_1
<
_
.
_1
)
val
blockLocations
=
StorageUtils
.
blockLocationsFromStorageStatus
(
filteredStorageStatusList
)
val
blocks
=
blockStatuses
.
map
{
case
(
id
,
status
)
=>
(
id
,
status
,
blockLocations
.
get
(
id
).
getOrElse
(
Seq
(
"UNKNOWN"
)))
}
val
blockTable
=
listingTable
(
blockHeaders
,
blockRow
,
blocks
)
val
content
=
...
...
@@ -74,8 +80,8 @@ private[spark] class RDDPage(parent: BlockManagerUI) {
headerSparkPage
(
content
,
parent
.
sc
,
"RDD Info: "
+
rddInfo
.
name
,
Jobs
)
}
def
blockRow
(
blk
:
(
String
,
BlockStatus
))
:
Seq
[
Node
]
=
{
val
(
id
,
block
)
=
blk
def
blockRow
(
row
:
(
String
,
BlockStatus
,
Seq
[
String
]
))
:
Seq
[
Node
]
=
{
val
(
id
,
block
,
locations
)
=
row
<
tr
>
<
td
>{
id
}</
td
>
<
td
>
...
...
@@ -87,6 +93,9 @@ private[spark] class RDDPage(parent: BlockManagerUI) {
<
td
sorttable_customkey
={
block
.
diskSize
.
toString
}>
{
Utils
.
memoryBytesToString
(
block
.
diskSize
)}
</
td
>
<
td
>
{
locations
.
map
(
l
=>
<
span
>{
l
}<
br
/></
span
>)}
</
td
>
</
tr
>
}
...
...
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