-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
351 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
309 changes: 139 additions & 170 deletions
309
core/src/main/resources/org/apache/spark/ui/static/streaming-page.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
core/src/test/scala/org/apache/spark/ui/UIUtilsSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
|
||
package org.apache.spark.ui | ||
|
||
import java.util.concurrent.TimeUnit | ||
|
||
import org.scalatest.FunSuite | ||
import org.scalatest.Matchers | ||
|
||
class UIUtilsSuite extends FunSuite with Matchers{ | ||
|
||
test("shortTimeUnitString") { | ||
assert("ns" === UIUtils.shortTimeUnitString(TimeUnit.NANOSECONDS)) | ||
assert("us" === UIUtils.shortTimeUnitString(TimeUnit.MICROSECONDS)) | ||
assert("ms" === UIUtils.shortTimeUnitString(TimeUnit.MILLISECONDS)) | ||
assert("sec" === UIUtils.shortTimeUnitString(TimeUnit.SECONDS)) | ||
assert("min" === UIUtils.shortTimeUnitString(TimeUnit.MINUTES)) | ||
assert("hrs" === UIUtils.shortTimeUnitString(TimeUnit.HOURS)) | ||
assert("days" === UIUtils.shortTimeUnitString(TimeUnit.DAYS)) | ||
} | ||
|
||
test("normalizeDuration") { | ||
verifyNormalizedTime(900, TimeUnit.MILLISECONDS, 900) | ||
verifyNormalizedTime(1.0, TimeUnit.SECONDS, 1000) | ||
verifyNormalizedTime(1.0, TimeUnit.MINUTES, 60 * 1000) | ||
verifyNormalizedTime(1.0, TimeUnit.HOURS, 60 * 60 * 1000) | ||
verifyNormalizedTime(1.0, TimeUnit.DAYS, 24 * 60 * 60 * 1000) | ||
} | ||
|
||
private def verifyNormalizedTime( | ||
expectedTime: Double, expectedUnit: TimeUnit, input: Long): Unit = { | ||
val (time, unit) = UIUtils.normalizeDuration(input) | ||
time should be (expectedTime +- 1E-6) | ||
unit should be (expectedUnit) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.