Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/2852#discussion_r19301013
--- Diff:
streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala ---
@@ -75,37 +89,45 @@ private[ui] class StreamingPage(parent: StreamingTab)
val receivedRecordDistributions = listener.receivedRecordsDistributions
val lastBatchReceivedRecord = listener.lastReceivedBatchRecords
val table = if (receivedRecordDistributions.size > 0) {
- val headerRow = Seq(
- "Receiver",
- "Status",
- "Location",
- "Records in last batch\n[" +
formatDate(Calendar.getInstance().getTime()) + "]",
- "Minimum rate\n[records/sec]",
- "Median rate\n[records/sec]",
- "Maximum rate\n[records/sec]",
- "Last Error"
- )
- val dataRows = (0 until listener.numReceivers).map { receiverId =>
- val receiverInfo = listener.receiverInfo(receiverId)
- val receiverName =
receiverInfo.map(_.name).getOrElse(s"Receiver-$receiverId")
- val receiverActive = receiverInfo.map { info =>
- if (info.active) "ACTIVE" else "INACTIVE"
- }.getOrElse(emptyCell)
- val receiverLocation =
receiverInfo.map(_.location).getOrElse(emptyCell)
- val receiverLastBatchRecords =
formatNumber(lastBatchReceivedRecord(receiverId))
- val receivedRecordStats =
receivedRecordDistributions(receiverId).map { d =>
- d.getQuantiles(Seq(0.0, 0.5, 1.0)).map(r =>
formatNumber(r.toLong))
- }.getOrElse {
- Seq(emptyCell, emptyCell, emptyCell, emptyCell, emptyCell)
+ val tableRenderer: UITable[(Int, Option[ReceiverInfo])] = {
+ val builder = new UITableBuilder[(Int, Option[ReceiverInfo])]()
+ import builder._
+ col("Receiver") { case (receiverId, receiverInfo) =>
+ receiverInfo.map(_.name).getOrElse(s"Receiver-$receiverId")
+ }
+ col("Status") { case (_, receiverInfo) =>
+ receiverInfo.map { info => if (info.active) "ACTIVE" else
"INACTIVE" }.getOrElse(empty)
+ }
+ col("Location") { case (_, receiverInfo) =>
receiverInfo.map(_.location).getOrElse(empty) }
+ col("Records in last batch\n[" +
formatDate(Calendar.getInstance().getTime()) + "]") {
+ case (receiverId, _) =>
formatNumber(lastBatchReceivedRecord(receiverId))
}
- val receiverLastError = listener.receiverInfo(receiverId).map {
info =>
- val msg = s"${info.lastErrorMessage} - ${info.lastError}"
- if (msg.size > 100) msg.take(97) + "..." else msg
- }.getOrElse(emptyCell)
- Seq(receiverName, receiverActive, receiverLocation,
receiverLastBatchRecords) ++
- receivedRecordStats ++ Seq(receiverLastError)
+ col("Minimum rate\n[records/sec]") {
+ case (receiverId, _) =>
receivedRecordDistributions(receiverId).map {
--- End diff --
i think the implicit style here is to put case on the previous line?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]