diff options
author | witgo <witgo@qq.com> | 2014-06-24 19:44:37 -0700 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-06-24 19:45:03 -0700 |
commit | b6b44853cd61660f2917b99d87c157e2b4430e5c (patch) | |
tree | 70c29d704860634658a576cb736ada7f33c21ce9 | |
parent | 2714968e1b40221739c5dfba7ca4c0c06953dbe2 (diff) | |
download | spark-b6b44853cd61660f2917b99d87c157e2b4430e5c.tar.gz spark-b6b44853cd61660f2917b99d87c157e2b4430e5c.tar.bz2 spark-b6b44853cd61660f2917b99d87c157e2b4430e5c.zip |
SPARK-2248: spark.default.parallelism does not apply in local mode
Author: witgo <witgo@qq.com>
Closes #1194 from witgo/SPARK-2248 and squashes the following commits:
6ac950b [witgo] spark.default.parallelism does not apply in local mode
-rw-r--r-- | core/src/main/scala/org/apache/spark/scheduler/local/LocalBackend.scala | 3 | ||||
-rw-r--r-- | core/src/test/scala/org/apache/spark/SparkContextSchedulerCreationSuite.scala | 16 |
2 files changed, 18 insertions, 1 deletions
diff --git a/core/src/main/scala/org/apache/spark/scheduler/local/LocalBackend.scala b/core/src/main/scala/org/apache/spark/scheduler/local/LocalBackend.scala index 43f0e18a0c..9b95ccca04 100644 --- a/core/src/main/scala/org/apache/spark/scheduler/local/LocalBackend.scala +++ b/core/src/main/scala/org/apache/spark/scheduler/local/LocalBackend.scala @@ -97,7 +97,8 @@ private[spark] class LocalBackend(scheduler: TaskSchedulerImpl, val totalCores: localActor ! ReviveOffers } - override def defaultParallelism() = totalCores + override def defaultParallelism() = + scheduler.conf.getInt("spark.default.parallelism", totalCores) override def killTask(taskId: Long, executorId: String, interruptThread: Boolean) { localActor ! KillTask(taskId, interruptThread) diff --git a/core/src/test/scala/org/apache/spark/SparkContextSchedulerCreationSuite.scala b/core/src/test/scala/org/apache/spark/SparkContextSchedulerCreationSuite.scala index 94fba10286..67e3be21c3 100644 --- a/core/src/test/scala/org/apache/spark/SparkContextSchedulerCreationSuite.scala +++ b/core/src/test/scala/org/apache/spark/SparkContextSchedulerCreationSuite.scala @@ -77,6 +77,22 @@ class SparkContextSchedulerCreationSuite } } + test("local-default-parallelism") { + val defaultParallelism = System.getProperty("spark.default.parallelism") + System.setProperty("spark.default.parallelism", "16") + val sched = createTaskScheduler("local") + + sched.backend match { + case s: LocalBackend => assert(s.defaultParallelism() === 16) + case _ => fail() + } + + Option(defaultParallelism) match { + case Some(v) => System.setProperty("spark.default.parallelism", v) + case _ => System.clearProperty("spark.default.parallelism") + } + } + test("simr") { createTaskScheduler("simr://uri").backend match { case s: SimrSchedulerBackend => // OK |