From 8444d7ce49e982b59cfbcb826500da26d8607632 Mon Sep 17 00:00:00 2001 From: Rui Li Date: Mon, 23 Jun 2014 10:36:17 +0800 Subject: [PATCH] fix code style --- .../scala/org/apache/spark/scheduler/TaskSetManager.scala | 6 +++--- .../org/apache/spark/scheduler/TaskSetManagerSuite.scala | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala b/core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala index dbf9a309b89ac..b5bcdd7e99c58 100644 --- a/core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala +++ b/core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala @@ -724,11 +724,11 @@ private[spark] class TaskSetManager( import TaskLocality.{PROCESS_LOCAL, NODE_LOCAL, RACK_LOCAL, ANY} val levels = new ArrayBuffer[TaskLocality.TaskLocality] if (!pendingTasksForExecutor.isEmpty && getLocalityWait(PROCESS_LOCAL) != 0 && - pendingTasksForExecutor.keySet.exists(sched.isExecutorAlive(_))) { + pendingTasksForExecutor.keySet.exists(sched.isExecutorAlive(_))) { levels += PROCESS_LOCAL } if (!pendingTasksForHost.isEmpty && getLocalityWait(NODE_LOCAL) != 0 && - pendingTasksForHost.keySet.exists(sched.hasExecutorsAliveOnHost(_))) { + pendingTasksForHost.keySet.exists(sched.hasExecutorsAliveOnHost(_))) { levels += NODE_LOCAL } if (!pendingTasksForRack.isEmpty && getLocalityWait(RACK_LOCAL) != 0) { @@ -744,7 +744,7 @@ private[spark] class TaskSetManager( def newLocAvail(index: Int): Boolean = { for (loc <- tasks(index).preferredLocations) { if (sched.hasExecutorsAliveOnHost(loc.host) || - sched.getRackForHost(loc.host).isDefined) { + sched.getRackForHost(loc.host).isDefined) { return true } } diff --git a/core/src/test/scala/org/apache/spark/scheduler/TaskSetManagerSuite.scala b/core/src/test/scala/org/apache/spark/scheduler/TaskSetManagerSuite.scala index bf9dcee98ac69..1cabcbe89f592 100644 --- a/core/src/test/scala/org/apache/spark/scheduler/TaskSetManagerSuite.scala +++ b/core/src/test/scala/org/apache/spark/scheduler/TaskSetManagerSuite.scala @@ -78,8 +78,8 @@ class FakeTaskScheduler(sc: SparkContext, liveExecutors: (String, String)* /* ex override def hasExecutorsAliveOnHost(host: String): Boolean = executors.values.exists(_ == host) - def addExecutor(newExecutors: (String, String)*) { - executors ++= newExecutors + def addExecutor(execId: String, host: String) { + executors.put(execId, host) } } @@ -403,14 +403,14 @@ class TaskSetManagerSuite extends FunSuite with LocalSparkContext with Logging { // Only ANY is valid assert(manager.myLocalityLevels.sameElements(Array(ANY))) // Add a new executor - sched.addExecutor(("execD", "host1")) + sched.addExecutor("execD", "host1") manager.executorAdded() // Task 0 and 1 should be removed from no-pref list assert(manager.pendingTasksWithNoPrefs.size === 2) // Valid locality should contain NODE_LOCAL and ANY assert(manager.myLocalityLevels.sameElements(Array(NODE_LOCAL, ANY))) // Add another executor - sched.addExecutor(("execC", "host2")) + sched.addExecutor("execC", "host2") manager.executorAdded() // No-pref list now only contains task 3 assert(manager.pendingTasksWithNoPrefs.size === 1)