Skip to content

Commit 8444d7c

Browse files
author
Rui Li
committed
fix code style
1 parent fafd57f commit 8444d7c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,11 +724,11 @@ private[spark] class TaskSetManager(
724724
import TaskLocality.{PROCESS_LOCAL, NODE_LOCAL, RACK_LOCAL, ANY}
725725
val levels = new ArrayBuffer[TaskLocality.TaskLocality]
726726
if (!pendingTasksForExecutor.isEmpty && getLocalityWait(PROCESS_LOCAL) != 0 &&
727-
pendingTasksForExecutor.keySet.exists(sched.isExecutorAlive(_))) {
727+
pendingTasksForExecutor.keySet.exists(sched.isExecutorAlive(_))) {
728728
levels += PROCESS_LOCAL
729729
}
730730
if (!pendingTasksForHost.isEmpty && getLocalityWait(NODE_LOCAL) != 0 &&
731-
pendingTasksForHost.keySet.exists(sched.hasExecutorsAliveOnHost(_))) {
731+
pendingTasksForHost.keySet.exists(sched.hasExecutorsAliveOnHost(_))) {
732732
levels += NODE_LOCAL
733733
}
734734
if (!pendingTasksForRack.isEmpty && getLocalityWait(RACK_LOCAL) != 0) {
@@ -744,7 +744,7 @@ private[spark] class TaskSetManager(
744744
def newLocAvail(index: Int): Boolean = {
745745
for (loc <- tasks(index).preferredLocations) {
746746
if (sched.hasExecutorsAliveOnHost(loc.host) ||
747-
sched.getRackForHost(loc.host).isDefined) {
747+
sched.getRackForHost(loc.host).isDefined) {
748748
return true
749749
}
750750
}

core/src/test/scala/org/apache/spark/scheduler/TaskSetManagerSuite.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ class FakeTaskScheduler(sc: SparkContext, liveExecutors: (String, String)* /* ex
7878

7979
override def hasExecutorsAliveOnHost(host: String): Boolean = executors.values.exists(_ == host)
8080

81-
def addExecutor(newExecutors: (String, String)*) {
82-
executors ++= newExecutors
81+
def addExecutor(execId: String, host: String) {
82+
executors.put(execId, host)
8383
}
8484
}
8585

@@ -403,14 +403,14 @@ class TaskSetManagerSuite extends FunSuite with LocalSparkContext with Logging {
403403
// Only ANY is valid
404404
assert(manager.myLocalityLevels.sameElements(Array(ANY)))
405405
// Add a new executor
406-
sched.addExecutor(("execD", "host1"))
406+
sched.addExecutor("execD", "host1")
407407
manager.executorAdded()
408408
// Task 0 and 1 should be removed from no-pref list
409409
assert(manager.pendingTasksWithNoPrefs.size === 2)
410410
// Valid locality should contain NODE_LOCAL and ANY
411411
assert(manager.myLocalityLevels.sameElements(Array(NODE_LOCAL, ANY)))
412412
// Add another executor
413-
sched.addExecutor(("execC", "host2"))
413+
sched.addExecutor("execC", "host2")
414414
manager.executorAdded()
415415
// No-pref list now only contains task 3
416416
assert(manager.pendingTasksWithNoPrefs.size === 1)

0 commit comments

Comments
 (0)