Skip to content

Commit d457277

Browse files
committed
Fix UIUtils in BatchPage
1 parent b3f303e commit d457277

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

streaming/src/main/scala/org/apache/spark/streaming/ui/AllBatchesTable.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package org.apache.spark.streaming.ui
1919

2020
import scala.xml.Node
2121

22-
import org.apache.spark.ui.UIUtils
22+
import org.apache.spark.ui.{UIUtils => SparkUIUtils}
2323

2424
private[ui] abstract class BatchTableBase(tableId: String) {
2525

@@ -32,12 +32,12 @@ private[ui] abstract class BatchTableBase(tableId: String) {
3232

3333
protected def baseRow(batch: BatchUIData): Seq[Node] = {
3434
val batchTime = batch.batchTime.milliseconds
35-
val formattedBatchTime = UIUtils.formatDate(batch.batchTime.milliseconds)
35+
val formattedBatchTime = SparkUIUtils.formatDate(batch.batchTime.milliseconds)
3636
val eventCount = batch.numRecords
3737
val schedulingDelay = batch.schedulingDelay
38-
val formattedSchedulingDelay = schedulingDelay.map(UIUtils.formatDuration).getOrElse("-")
38+
val formattedSchedulingDelay = schedulingDelay.map(SparkUIUtils.formatDuration).getOrElse("-")
3939
val processingTime = batch.processingDelay
40-
val formattedProcessingTime = processingTime.map(UIUtils.formatDuration).getOrElse("-")
40+
val formattedProcessingTime = processingTime.map(SparkUIUtils.formatDuration).getOrElse("-")
4141

4242
<td sorttable_customkey={batchTime.toString}>
4343
<a href={s"batch?id=$batchTime"}>
@@ -107,7 +107,7 @@ private[ui] class CompletedBatchTable(batches: Seq[BatchUIData])
107107

108108
private def completedBatchRow(batch: BatchUIData): Seq[Node] = {
109109
val totalDelay = batch.totalDelay
110-
val formattedTotalDelay = totalDelay.map(UIUtils.formatDuration).getOrElse("-")
110+
val formattedTotalDelay = totalDelay.map(SparkUIUtils.formatDuration).getOrElse("-")
111111
baseRow(batch) ++
112112
<td sorttable_customkey={totalDelay.getOrElse(Long.MaxValue).toString}>
113113
{formattedTotalDelay}

streaming/src/main/scala/org/apache/spark/streaming/ui/BatchPage.scala

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import scala.xml.{NodeSeq, Node}
2424
import org.apache.commons.lang3.StringEscapeUtils
2525

2626
import org.apache.spark.streaming.Time
27-
import org.apache.spark.ui.{UIUtils, WebUIPage}
27+
import org.apache.spark.ui.{UIUtils => SparkUIUtils, WebUIPage}
2828
import org.apache.spark.streaming.ui.StreamingJobProgressListener.{SparkJobId, OutputOpId}
2929
import org.apache.spark.ui.jobs.UIData.JobUIData
3030

@@ -73,8 +73,8 @@ private[ui] class BatchPage(parent: StreamingTab) extends WebUIPage("batch") {
7373
sparkJob.stageIds.sorted.reverse.flatMap(sparkListener.stageIdToInfo.get).
7474
dropWhile(_.failureReason == None).take(1). // get the first info that contains failure
7575
flatMap(info => info.failureReason).headOption.getOrElse("")
76-
val formattedDuration = duration.map(d => UIUtils.formatDuration(d)).getOrElse("-")
77-
val detailUrl = s"${UIUtils.prependBaseUri(parent.basePath)}/jobs/job?id=${sparkJob.jobId}"
76+
val formattedDuration = duration.map(d => SparkUIUtils.formatDuration(d)).getOrElse("-")
77+
val detailUrl = s"${SparkUIUtils.prependBaseUri(parent.basePath)}/jobs/job?id=${sparkJob.jobId}"
7878

7979
// In the first row, output op id and its information needs to be shown. In other rows, these
8080
// cells will be taken up due to "rowspan".
@@ -110,7 +110,7 @@ private[ui] class BatchPage(parent: StreamingTab) extends WebUIPage("batch") {
110110
</td>
111111
<td class="progress-cell">
112112
{
113-
UIUtils.makeProgressBar(
113+
SparkUIUtils.makeProgressBar(
114114
started = sparkJob.numActiveTasks,
115115
completed = sparkJob.numCompletedTasks,
116116
failed = sparkJob.numFailedTasks,
@@ -135,7 +135,7 @@ private[ui] class BatchPage(parent: StreamingTab) extends WebUIPage("batch") {
135135
// If any job does not finish, set "formattedOutputOpDuration" to "-"
136136
"-"
137137
} else {
138-
UIUtils.formatDuration(sparkjobDurations.flatMap(x => x).sum)
138+
SparkUIUtils.formatDuration(sparkjobDurations.flatMap(x => x).sum)
139139
}
140140
generateJobRow(outputOpId, formattedOutputOpDuration, sparkJobs.size, true, sparkJobs.head) ++
141141
sparkJobs.tail.map { sparkJob =>
@@ -212,24 +212,24 @@ private[ui] class BatchPage(parent: StreamingTab) extends WebUIPage("batch") {
212212
val batchTime = Option(request.getParameter("id")).map(id => Time(id.toLong)).getOrElse {
213213
throw new IllegalArgumentException(s"Missing id parameter")
214214
}
215-
val formattedBatchTime = UIUtils.formatDate(batchTime.milliseconds)
215+
val formattedBatchTime = SparkUIUtils.formatDate(batchTime.milliseconds)
216216

217217
val batchUIData = streamingListener.getBatchUIData(batchTime).getOrElse {
218218
throw new IllegalArgumentException(s"Batch $formattedBatchTime does not exist")
219219
}
220220

221221
val formattedSchedulingDelay =
222-
batchUIData.schedulingDelay.map(UIUtils.formatDuration).getOrElse("-")
222+
batchUIData.schedulingDelay.map(SparkUIUtils.formatDuration).getOrElse("-")
223223
val formattedProcessingTime =
224-
batchUIData.processingDelay.map(UIUtils.formatDuration).getOrElse("-")
225-
val formattedTotalDelay = batchUIData.totalDelay.map(UIUtils.formatDuration).getOrElse("-")
224+
batchUIData.processingDelay.map(SparkUIUtils.formatDuration).getOrElse("-")
225+
val formattedTotalDelay = batchUIData.totalDelay.map(SparkUIUtils.formatDuration).getOrElse("-")
226226

227227
val summary: NodeSeq =
228228
<div>
229229
<ul class="unstyled">
230230
<li>
231231
<strong>Batch Duration: </strong>
232-
{UIUtils.formatDuration(streamingListener.batchDuration)}
232+
{SparkUIUtils.formatDuration(streamingListener.batchDuration)}
233233
</li>
234234
<li>
235235
<strong>Input data size: </strong>
@@ -259,6 +259,6 @@ private[ui] class BatchPage(parent: StreamingTab) extends WebUIPage("batch") {
259259

260260
val content = summary ++ jobTable
261261

262-
UIUtils.headerSparkPage(s"Details of batch at $formattedBatchTime", content, parent)
262+
SparkUIUtils.headerSparkPage(s"Details of batch at $formattedBatchTime", content, parent)
263263
}
264264
}

0 commit comments

Comments
 (0)