diff options
author | robbins <robbins@uk.ibm.com> | 2015-09-03 13:47:22 -0700 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2015-09-03 13:47:25 -0700 |
commit | d911c682f00cd5c438568c548098e03d3e7ea05c (patch) | |
tree | de6480083d55b158f6a4ec680094bd57b78863da /core | |
parent | 49aff7b9add4a70fb229c93f15394387bde142b8 (diff) | |
download | spark-d911c682f00cd5c438568c548098e03d3e7ea05c.tar.gz spark-d911c682f00cd5c438568c548098e03d3e7ea05c.tar.bz2 spark-d911c682f00cd5c438568c548098e03d3e7ea05c.zip |
[SPARK-10431] [CORE] Fix intermittent test failure. Wait for event queue to be clear
Author: robbins <robbins@uk.ibm.com>
Closes #8582 from robbinspg/InputOutputMetricsSuite.
Diffstat (limited to 'core')
-rw-r--r-- | core/src/test/scala/org/apache/spark/metrics/InputOutputMetricsSuite.scala | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/src/test/scala/org/apache/spark/metrics/InputOutputMetricsSuite.scala b/core/src/test/scala/org/apache/spark/metrics/InputOutputMetricsSuite.scala index d3218a548e..44eb5a0469 100644 --- a/core/src/test/scala/org/apache/spark/metrics/InputOutputMetricsSuite.scala +++ b/core/src/test/scala/org/apache/spark/metrics/InputOutputMetricsSuite.scala @@ -286,6 +286,10 @@ class InputOutputMetricsSuite extends SparkFunSuite with SharedSparkContext private def runAndReturnMetrics(job: => Unit, collector: (SparkListenerTaskEnd) => Option[Long]): Long = { val taskMetrics = new ArrayBuffer[Long]() + + // Avoid receiving earlier taskEnd events + sc.listenerBus.waitUntilEmpty(500) + sc.addSparkListener(new SparkListener() { override def onTaskEnd(taskEnd: SparkListenerTaskEnd) { collector(taskEnd).foreach(taskMetrics += _) |