Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/19750#discussion_r151287944
--- Diff: core/src/main/scala/org/apache/spark/TestUtils.scala ---
@@ -232,6 +232,30 @@ private[spark] object TestUtils {
}
}
+ /**
+ * Wait until at least `numExecutors` executors are up, or throw
`TimeoutException` if the waiting
+ * time elapsed before `numExecutors` executors up. Exposed for testing.
+ *
+ * @param numExecutors the number of executors to wait at least
+ * @param timeout time to wait in milliseconds
+ */
+ private[spark] def waitUntilExecutorsUp(
+ sc: SparkContext,
+ numExecutors: Int,
+ timeout: Long): Unit = {
+ val finishTime = System.nanoTime() +
TimeUnit.MILLISECONDS.toNanos(timeout)
+ while (System.nanoTime() < finishTime) {
+ if (sc.statusTracker.getExecutorInfos.length > numExecutors) {
--- End diff --
`getExecutorInfos` includes the driver...
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]