Github user squito commented on a diff in the pull request:
https://github.com/apache/spark/pull/16650#discussion_r99664044
--- Diff:
core/src/test/scala/org/apache/spark/deploy/StandaloneDynamicAllocationSuite.scala
---
@@ -467,6 +469,52 @@ class StandaloneDynamicAllocationSuite
}
}
+ test("kill all executors on localhost") {
+ sc = new SparkContext(appConf)
+ val appId = sc.applicationId
+ eventually(timeout(10.seconds), interval(10.millis)) {
+ val apps = getApplications()
+ assert(apps.size === 1)
+ assert(apps.head.id === appId)
+ assert(apps.head.executors.size === 2)
+ assert(apps.head.getExecutorLimit === Int.MaxValue)
+ }
+ val beforeList = getApplications().head.executors.keys.toSet
+ assert(killExecutorsOnHost(sc, "localhost").equals(true))
+
+ syncExecutors(sc)
+ val afterList = getApplications().head.executors.keys.toSet
+
+ eventually(timeout(10.seconds), interval(100.millis)) {
+ assert(beforeList.intersect(afterList).size == 0)
+ }
+ }
+
+ test("executor registration on a blacklisted host must fail") {
+ sc = new SparkContext(appConf.set(config.BLACKLIST_ENABLED.key,
"true"))
+ val endpointRef = mock(classOf[RpcEndpointRef])
+ val mockAddress = mock(classOf[RpcAddress])
+ when(endpointRef.address).thenReturn(mockAddress)
+ val message = RegisterExecutor("one", endpointRef, "blacklisted-host",
10, Map.empty)
+
+ // Get "localhost" on a blacklist.
+ val taskScheduler = mock(classOf[TaskSchedulerImpl])
+ when(taskScheduler.nodeBlacklist()).thenReturn(Set("blacklisted-host"))
+ when(taskScheduler.sc).thenReturn(sc)
+ sc.taskScheduler = taskScheduler
+
+ // Create a fresh scheduler backend to blacklist "localhost".
+ sc.schedulerBackend.stop()
+ val backend =
+ new StandaloneSchedulerBackend(taskScheduler, sc,
Array(masterRpcEnv.address.toSparkURL))
--- End diff --
super nit: looks like this is only indented one space, not two
---
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]