@@ -27,7 +27,7 @@ import scala.xml.{Node, Unparsed}
27
27
28
28
import org .apache .spark .Logging
29
29
import org .apache .spark .ui ._
30
- import org .apache .spark .ui .UIUtils . _
30
+ import org .apache .spark .ui .{ UIUtils => SparkUIUtils }
31
31
32
32
/**
33
33
* @param timelineDivId the timeline `id` used in the html `div` tag
@@ -103,13 +103,13 @@ private[ui] class MillisecondsStatUIData(data: Seq[(Long, Long)]) {
103
103
* Converting the original data as per `unit`.
104
104
*/
105
105
def timelineData (unit : TimeUnit ): Seq [(Long , Double )] =
106
- data.map(x => x._1 -> StreamingPage .convertToTimeUnit(x._2, unit))
106
+ data.map(x => x._1 -> UIUtils .convertToTimeUnit(x._2, unit))
107
107
108
108
/**
109
109
* Converting the original data as per `unit`.
110
110
*/
111
111
def histogramData (unit : TimeUnit ): Seq [Double ] =
112
- data.map(x => StreamingPage .convertToTimeUnit(x._2, unit))
112
+ data.map(x => UIUtils .convertToTimeUnit(x._2, unit))
113
113
114
114
val avg : Option [Long ] = if (data.isEmpty) None else Some (data.map(_._2).sum / data.size)
115
115
@@ -149,17 +149,17 @@ private[ui] class StreamingPage(parent: StreamingTab)
149
149
generateStatTable() ++
150
150
generateBatchListTables()
151
151
}
152
- UIUtils .headerSparkPage(" Streaming Statistics" , content, parent, Some (5000 ))
152
+ SparkUIUtils .headerSparkPage(" Streaming Statistics" , content, parent, Some (5000 ))
153
153
}
154
154
155
155
/**
156
156
* Generate html that will load css/js files for StreamingPage
157
157
*/
158
158
private def generateLoadResources (): Seq [Node ] = {
159
159
// scalastyle:off
160
- <script src ={UIUtils .prependBaseUri(" /static/d3.min.js" )}></script >
161
- <link rel =" stylesheet" href ={UIUtils .prependBaseUri(" /static/streaming-page.css" )} type =" text/css" />
162
- <script src ={UIUtils .prependBaseUri(" /static/streaming-page.js" )}></script >
160
+ <script src ={SparkUIUtils .prependBaseUri(" /static/d3.min.js" )}></script >
161
+ <link rel =" stylesheet" href ={SparkUIUtils .prependBaseUri(" /static/streaming-page.css" )} type =" text/css" />
162
+ <script src ={SparkUIUtils .prependBaseUri(" /static/streaming-page.js" )}></script >
163
163
// scalastyle:on
164
164
}
165
165
@@ -168,15 +168,15 @@ private[ui] class StreamingPage(parent: StreamingTab)
168
168
val timeSinceStart = System .currentTimeMillis() - startTime
169
169
<div >Running batches of
170
170
<strong >
171
- {formatDurationVerbose(listener.batchDuration)}
171
+ {SparkUIUtils . formatDurationVerbose(listener.batchDuration)}
172
172
</strong >
173
173
for
174
174
<strong >
175
- {formatDurationVerbose(timeSinceStart)}
175
+ {SparkUIUtils . formatDurationVerbose(timeSinceStart)}
176
176
</strong >
177
177
since
178
178
<strong >
179
- {UIUtils .formatDate(startTime)}
179
+ {SparkUIUtils .formatDate(startTime)}
180
180
</strong >
181
181
</div >
182
182
<br />
@@ -247,7 +247,7 @@ private[ui] class StreamingPage(parent: StreamingTab)
247
247
| document.title, window.location.pathname + '?show-streams-detail=' + status); """
248
248
.stripMargin.replaceAll(" \\ n" , " " ) // it must be only one single line
249
249
250
- val batchInterval = StreamingPage .convertToTimeUnit(listener.batchDuration, normalizedUnit)
250
+ val batchInterval = UIUtils .convertToTimeUnit(listener.batchDuration, normalizedUnit)
251
251
252
252
val jsCollector = new JsCollector
253
253
@@ -423,7 +423,7 @@ private[ui] class StreamingPage(parent: StreamingTab)
423
423
if (msg.size > 100 ) msg.take(97 ) + " ..." else msg
424
424
}.getOrElse(emptyCell)
425
425
val receiverLastErrorTime = receiverInfo.map {
426
- r => if (r.lastErrorTime < 0 ) " -" else UIUtils .formatDate(r.lastErrorTime)
426
+ r => if (r.lastErrorTime < 0 ) " -" else SparkUIUtils .formatDate(r.lastErrorTime)
427
427
}.getOrElse(emptyCell)
428
428
val receivedRecords = new EventRateUIData (eventRates)
429
429
@@ -491,22 +491,9 @@ private[ui] object StreamingPage {
491
491
* Returns a human-readable string representing a duration such as "5 second 35 ms"
492
492
*/
493
493
def formatDurationOption (msOption : Option [Long ]): String = {
494
- msOption.map(formatDurationVerbose).getOrElse(emptyCell)
494
+ msOption.map(SparkUIUtils . formatDurationVerbose).getOrElse(emptyCell)
495
495
}
496
496
497
- /**
498
- * Convert `milliseconds` to the specified `unit`. We cannot use `TimeUnit.convert` because it
499
- * will discard the fractional part.
500
- */
501
- def convertToTimeUnit (milliseconds : Long , unit : TimeUnit ): Double = unit match {
502
- case TimeUnit .NANOSECONDS => milliseconds * 1000 * 1000
503
- case TimeUnit .MICROSECONDS => milliseconds * 1000
504
- case TimeUnit .MILLISECONDS => milliseconds
505
- case TimeUnit .SECONDS => milliseconds / 1000.0
506
- case TimeUnit .MINUTES => milliseconds / 1000.0 / 60.0
507
- case TimeUnit .HOURS => milliseconds / 1000.0 / 60.0 / 60.0
508
- case TimeUnit .DAYS => milliseconds / 1000.0 / 60.0 / 60.0 / 24.0
509
- }
510
497
}
511
498
512
499
/**
0 commit comments