Github user kayousterhout commented on a diff in the pull request: https://github.com/apache/spark/pull/15326#discussion_r109322987 --- Diff: core/src/test/scala/org/apache/spark/scheduler/PoolSuite.scala --- @@ -292,7 +290,100 @@ class PoolSuite extends SparkFunSuite with LocalSparkContext { } } - private def verifyPool(rootPool: Pool, poolName: String, expectedInitMinShare: Int, + test("FIFO Scheduler should not add duplicate TaskSetManager") { + sc = new SparkContext(LOCAL, APP_NAME) + val taskScheduler = new TaskSchedulerImpl(sc) + + val rootPool = new Pool("", SchedulingMode.FIFO, 0, 0) + val schedulableBuilder = new FIFOSchedulableBuilder(rootPool) + + val taskSetManager0 = createTaskSetManager(0, 2, taskScheduler) + val taskSetManager1 = createTaskSetManager(1, 2, taskScheduler) + schedulableBuilder.addTaskSetManager(taskSetManager0, null) + schedulableBuilder.addTaskSetManager(taskSetManager0, null) + schedulableBuilder.addTaskSetManager(taskSetManager1, null) + + assert(rootPool.schedulableQueue.size === 2) + assert(rootPool.schedulableNameToSchedulable.size === 2) + + assert(rootPool.getSchedulableByName(taskSetManager0.name) === taskSetManager0) + assert(rootPool.getSchedulableByName(taskSetManager1.name) === taskSetManager1) + } + + test("Fair Scheduler should not create duplicate pool") { + sc = createSparkContext("fairscheduler-duplicate-pools.xml") + + val rootPool = new Pool("", SchedulingMode.FAIR, 0, 0) + val schedulableBuilder = new FairSchedulableBuilder(rootPool, sc.conf) + schedulableBuilder.buildPools() + + assert(rootPool.schedulableQueue.size === 2) + assert(rootPool.schedulableNameToSchedulable.size === 2) + + verifyPool(rootPool, schedulableBuilder.DEFAULT_POOL_NAME, 0, 1, SchedulingMode.FIFO) + verifyPool(rootPool, "duplicate_pool1", 1, 1, SchedulingMode.FAIR) --- End diff -- can you add a comment here saying to make sure that the 1st pool specified is the one that gets used?
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org