Skip to content

Commit

Permalink
Merge pull request alteryx#241 from pwendell/branch-0.8
Browse files Browse the repository at this point in the history
Fix race condition in JobLoggerSuite [0.8 branch]

I found this when running the tests locally. It's similar to a race condition found when making the 0.8.0 release.
  • Loading branch information
pwendell committed Dec 7, 2013
2 parents d0b9fce + 295734f commit 9c9e71e
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import org.apache.spark.rdd.RDD


class JobLoggerSuite extends FunSuite with LocalSparkContext with ShouldMatchers {
/** Length of time to wait while draining listener events. */
val WAIT_TIMEOUT_MILLIS = 10000

test("inner method") {
sc = new SparkContext("local", "joblogger")
Expand Down Expand Up @@ -91,6 +93,7 @@ class JobLoggerSuite extends FunSuite with LocalSparkContext with ShouldMatchers
sc.addSparkListener(joblogger)
val rdd = sc.parallelize(1 to 1e2.toInt, 4).map{ i => (i % 12, 2 * i) }
rdd.reduceByKey(_+_).collect()
assert(sc.dagScheduler.listenerBus.waitUntilEmpty(WAIT_TIMEOUT_MILLIS))

val user = System.getProperty("user.name", SparkContext.SPARK_UNKNOWN_USER)

Expand Down Expand Up @@ -119,8 +122,9 @@ class JobLoggerSuite extends FunSuite with LocalSparkContext with ShouldMatchers
}
sc.addSparkListener(joblogger)
val rdd = sc.parallelize(1 to 1e2.toInt, 4).map{ i => (i % 12, 2 * i) }
rdd.reduceByKey(_+_).collect()

rdd.reduceByKey(_+_).collect()
assert(sc.dagScheduler.listenerBus.waitUntilEmpty(WAIT_TIMEOUT_MILLIS))

joblogger.onJobStartCount should be (1)
joblogger.onJobEndCount should be (1)
joblogger.onTaskEndCount should be (8)
Expand Down

0 comments on commit 9c9e71e

Please sign in to comment.