Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-8100][UI]Make able to refer lost executor info in Spark UI #6644

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion core/src/main/scala/org/apache/spark/status/api/v1/api.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ class ExecutorSummary private[spark](
val totalShuffleRead: Long,
val totalShuffleWrite: Long,
val maxMemory: Long,
val executorLogs: Map[String, String])
val executorLogs: Map[String, String],
// Since in 1.5.0
val isRemoved: Boolean)

class JobData private[spark](
val jobId: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class StorageStatusListener extends SparkListener {
override def onBlockManagerRemoved(blockManagerRemoved: SparkListenerBlockManagerRemoved) {
synchronized {
val executorId = blockManagerRemoved.blockManagerId.executorId
executorIdToStorageStatus.remove(executorId)
executorIdToStorageStatus(executorId).markAsRemoved
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ class StorageStatus(val blockManagerId: BlockManagerId, val maxMem: Long) {
private val _rddStorageInfo = new mutable.HashMap[Int, (Long, Long, Long, StorageLevel)]
private var _nonRddStorageInfo: (Long, Long, Long) = (0L, 0L, 0L)

private var _blockManagerRemoved = false

def isRemoved: Boolean = _blockManagerRemoved
def markAsRemoved(): Unit = _blockManagerRemoved = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think about tracking the time it was removed as well?


/** Create a storage status with an initial set of blocks, leaving the source unmodified. */
def this(bmid: BlockManagerId, maxMem: Long, initialBlocks: Map[BlockId, BlockStatus]) {
this(bmid, maxMem)
Expand Down
26 changes: 17 additions & 9 deletions core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ private[ui] case class ExecutorSummaryInfo(
totalShuffleRead: Long,
totalShuffleWrite: Long,
maxMemory: Long,
executorLogs: Map[String, String])
executorLogs: Map[String, String],
isRemoved: Boolean)


private[ui] class ExecutorsPage(
Expand All @@ -53,9 +54,11 @@ private[ui] class ExecutorsPage(

def render(request: HttpServletRequest): Seq[Node] = {
val storageStatusList = listener.storageStatusList
val maxMem = storageStatusList.map(_.maxMem).sum
val memUsed = storageStatusList.map(_.memUsed).sum
val diskUsed = storageStatusList.map(_.diskUsed).sum
val activeStorageStatusList = storageStatusList.filter(!_.isRemoved)
val maxMem = activeStorageStatusList.map(_.maxMem).sum
val memUsed = activeStorageStatusList.map(_.memUsed).sum
val diskUsed = activeStorageStatusList.map(_.diskUsed).sum
val activeExecSize = activeStorageStatusList.size
val execInfo = for (statusId <- 0 until storageStatusList.size) yield
ExecutorsPage.getExecInfo(listener, statusId)
val execInfoSorted = execInfo.sortBy(_.id)
Expand Down Expand Up @@ -85,7 +88,7 @@ private[ui] class ExecutorsPage(
</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewor14 I not remove that actually, Because for the lost executor, it can't do dump,
So I change that column head to "Status", for executor live, will show dump, for executor lost, will show a "Removed" status.

</th>
{if (logsExist) <th class="sorttable_nosort">Logs</th> else Seq.empty}
{if (threadDumpEnabled) <th class="sorttable_nosort">Thread Dump</th> else Seq.empty}
<th class="sorttable_nosort">Status</th>
</thead>
<tbody>
{execInfoSorted.map(execRow(_, logsExist))}
Expand All @@ -109,7 +112,8 @@ private[ui] class ExecutorsPage(
</div>
</div>;

UIUtils.headerSparkPage("Executors (" + execInfo.size + ")", content, parent)
UIUtils.headerSparkPage("Executors (Active: " + activeExecSize +
", Total Allocated: " + execInfo.size + ")", content, parent)
}

/** Render an HTML row representing an executor */
Expand Down Expand Up @@ -160,13 +164,15 @@ private[ui] class ExecutorsPage(
}
}
{
if (threadDumpEnabled) {
if (info.isRemoved) {
<td>Removed</td>
} else if (threadDumpEnabled) {
val encodedId = URLEncoder.encode(info.id, "UTF-8")
<td>
<a href={s"threadDump/?executorId=${encodedId}"}>Thread Dump</a>
</td>
} else {
Seq.empty
<td></td>
}
}
</tr>
Expand All @@ -193,6 +199,7 @@ private[spark] object ExecutorsPage {
val totalShuffleRead = listener.executorToShuffleRead.getOrElse(execId, 0L)
val totalShuffleWrite = listener.executorToShuffleWrite.getOrElse(execId, 0L)
val executorLogs = listener.executorToLogUrls.getOrElse(execId, Map.empty)
val isRemoved = status.isRemoved

new ExecutorSummary(
execId,
Expand All @@ -209,7 +216,8 @@ private[spark] object ExecutorsPage {
totalShuffleRead,
totalShuffleWrite,
maxMem,
executorLogs
executorLogs,
isRemoved
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class StorageListener(storageStatusListener: StorageStatusListener) extends Bloc

private[ui] val _rddInfoMap = mutable.Map[Int, RDDInfo]() // exposed for testing

def storageStatusList: Seq[StorageStatus] = storageStatusListener.storageStatusList
def storageStatusList: Seq[StorageStatus] =
storageStatusListener.storageStatusList.filter(!_.isRemoved)

/** Filter RDD info to include only those with cached partitions */
def rddInfoList: Seq[RDDInfo] = synchronized {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"totalShuffleRead" : 0,
"totalShuffleWrite" : 13180,
"maxMemory" : 278302556,
"executorLogs" : { }
"executorLogs" : { },
"isRemoved": false
} ]
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ class StorageStatusListenerSuite extends SparkFunSuite {

// Block manager remove
listener.onBlockManagerRemoved(SparkListenerBlockManagerRemoved(1L, bm1))
assert(listener.executorIdToStorageStatus.size === 1)
assert(!listener.executorIdToStorageStatus.get("big").isDefined)
assert(listener.executorIdToStorageStatus.get("fat").isDefined)
assert(listener.executorIdToStorageStatus.size === 2)
assert(listener.storageStatusList.count(!_.isRemoved) == 1)
assert(listener.executorIdToStorageStatus.get("big").get.isRemoved)
assert(!listener.executorIdToStorageStatus.get("fat").get.isRemoved)
listener.onBlockManagerRemoved(SparkListenerBlockManagerRemoved(1L, bm2))
assert(listener.executorIdToStorageStatus.size === 0)
assert(!listener.executorIdToStorageStatus.get("big").isDefined)
assert(!listener.executorIdToStorageStatus.get("fat").isDefined)
assert(listener.executorIdToStorageStatus.size === 2)
assert(listener.storageStatusList.count(!_.isRemoved) == 0)
assert(listener.executorIdToStorageStatus.get("big").get.isRemoved)
assert(listener.executorIdToStorageStatus.get("fat").get.isRemoved)
}

test("task end without updated blocks") {
Expand Down
4 changes: 4 additions & 0 deletions project/MimaExcludes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ object MimaExcludes {
ProblemFilters.exclude[MissingClassProblem]("org.apache.spark.sql.sources.PartitionSpec$"),
ProblemFilters.exclude[MissingClassProblem]("org.apache.spark.sql.sources.DescribeCommand"),
ProblemFilters.exclude[MissingClassProblem]("org.apache.spark.sql.sources.DDLException")
) ++ Seq(
// SPARK-8100 Make able to refer lost executor info in Spark UI
ProblemFilters.exclude[MissingMethodProblem](
"org.apache.spark.status.api.v1.ExecutorSummary.this")
)

case v if v.startsWith("1.4") =>
Expand Down