Github user janewangfb commented on a diff in the pull request:
https://github.com/apache/spark/pull/18492#discussion_r134574304
--- Diff:
core/src/test/scala/org/apache/spark/ExecutorAllocationManagerSuite.scala ---
@@ -188,6 +188,40 @@ class ExecutorAllocationManagerSuite
assert(numExecutorsTarget(manager) === 10)
}
+ test("add executors when speculative tasks added") {
+ sc = createSparkContext(0, 10, 0)
+ val manager = sc.executorAllocationManager.get
+
+ // Verify that we're capped at number of tasks including the
speculative ones in the stage
+ sc.listenerBus.postToAll(SparkListenerSpeculativeTaskSubmitted(1))
+ assert(numExecutorsTarget(manager) === 0)
+ assert(numExecutorsToAdd(manager) === 1)
+ assert(addExecutors(manager) === 1)
+ sc.listenerBus.postToAll(SparkListenerSpeculativeTaskSubmitted(1))
+ sc.listenerBus.postToAll(SparkListenerSpeculativeTaskSubmitted(1))
+
sc.listenerBus.postToAll(SparkListenerStageSubmitted(createStageInfo(1, 2)))
+ assert(numExecutorsTarget(manager) === 1)
+ assert(numExecutorsToAdd(manager) === 2)
+ assert(addExecutors(manager) === 2)
+ assert(numExecutorsTarget(manager) === 3)
+ assert(numExecutorsToAdd(manager) === 4)
+ assert(addExecutors(manager) === 2)
+ assert(numExecutorsTarget(manager) === 5)
+ assert(numExecutorsToAdd(manager) === 1)
+
+ // Verify that running a task doesn't affect the target
--- End diff --
It is because we use the sum of (running + appending) jobs to calculate how
many executors are needed (maxNumExecutorsNeeded). so wether a task is pending
or running, the executors needed are the same.
---
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]