[SPARK-20483][MINOR] Test for Mesos Coarse mode may starve other Mesos frameworks

## What changes were proposed in this pull request?

Add test case for scenarios where executor.cores is set as a
(non)divisor of spark.cores.max
This tests the change in
#17786

## How was this patch tested?

Ran the existing test suite with the new tests

dbtsai

Author: Davis Shepherd <dshepherd@netflix.com>

Closes #17788 from dgshep/add_mesos_test.
This commit is contained in:
Davis Shepherd 2017-04-27 20:25:52 +00:00 committed by DB Tsai
parent a4aa4665a6
commit 039e32ca19
No known key found for this signature in database
GPG key ID: E6FD79DA81FE14FD

View file

@ -199,6 +199,40 @@ class MesosCoarseGrainedSchedulerBackendSuite extends SparkFunSuite
verifyDeclinedOffer(driver, createOfferId("o2"), true)
}
test("mesos declines offers with a filter when maxCores not a multiple of executor.cores") {
val maxCores = 4
val executorCores = 3
setBackend(Map(
"spark.cores.max" -> maxCores.toString,
"spark.executor.cores" -> executorCores.toString
))
val executorMemory = backend.executorMemory(sc)
offerResources(List(
Resources(executorMemory, maxCores + 1),
Resources(executorMemory, maxCores + 1)
))
verifyTaskLaunched(driver, "o1")
verifyDeclinedOffer(driver, createOfferId("o2"), true)
}
test("mesos declines offers with a filter when reached spark.cores.max with executor.cores") {
val maxCores = 4
val executorCores = 2
setBackend(Map(
"spark.cores.max" -> maxCores.toString,
"spark.executor.cores" -> executorCores.toString
))
val executorMemory = backend.executorMemory(sc)
offerResources(List(
Resources(executorMemory, maxCores + 1),
Resources(executorMemory, maxCores + 1),
Resources(executorMemory, maxCores + 1)
))
verifyTaskLaunched(driver, "o1")
verifyTaskLaunched(driver, "o2")
verifyDeclinedOffer(driver, createOfferId("o3"), true)
}
test("mesos assigns tasks round-robin on offers") {
val executorCores = 4
val maxCores = executorCores * 2