Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/7457#discussion_r34862071
--- Diff:
mllib/src/test/scala/org/apache/spark/ml/util/StopwatchSuite.scala ---
@@ -29,18 +33,27 @@ class StopwatchSuite extends SparkFunSuite with
MLlibTestSparkContext {
intercept[AssertionError] {
sw.stop()
}
+ val ubStart = now
sw.start()
- Thread.sleep(50)
+ val lbStart = now
+ runTask()
+ val lb = now - lbStart
val duration = sw.stop()
- assert(duration >= 50 && duration < 100) // using a loose upper bound
+ val ub = now - ubStart
+ assert(duration >= lb && duration <= ub)
val elapsed = sw.elapsed()
assert(elapsed === duration)
+ val ubStart2 = now
--- End diff --
It might be nice to create a helper method, rather than the now-complex
timing code which gets repeated for each start/stop section in these tests.
---
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]