From 6eeb7f1077ba8d629fa49cc838c5176b9ce27b6d Mon Sep 17 00:00:00 2001 From: Shixiong Zhu Date: Wed, 31 Aug 2016 16:55:34 -0700 Subject: [PATCH] Wait until executors are up before running jobs --- .../src/test/scala/org/apache/spark/repl/ReplSuite.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/repl/scala-2.11/src/test/scala/org/apache/spark/repl/ReplSuite.scala b/repl/scala-2.11/src/test/scala/org/apache/spark/repl/ReplSuite.scala index f1284b1df31b4..f7d7a4f041315 100644 --- a/repl/scala-2.11/src/test/scala/org/apache/spark/repl/ReplSuite.scala +++ b/repl/scala-2.11/src/test/scala/org/apache/spark/repl/ReplSuite.scala @@ -399,6 +399,15 @@ class ReplSuite extends SparkFunSuite { test("replicating blocks of object with class defined in repl") { val output = runInterpreter("local-cluster[2,1,1024]", """ + |val timeout = 60000 // 60 seconds + |val start = System.currentTimeMillis + |while(sc.getExecutorStorageStatus.size != 3 && + | (System.currentTimeMillis - start) < timeout) { + | Thread.sleep(10) + |} + |if (System.currentTimeMillis - start >= timeout) { + | throw new java.util.concurrent.TimeoutException("Executors were not up in 60 seconds") + |} |import org.apache.spark.storage.StorageLevel._ |case class Foo(i: Int) |val ret = sc.parallelize((1 to 100).map(Foo), 10).persist(MEMORY_AND_DISK_2)