@@ -114,9 +114,8 @@ private[spark] class TaskSetManager(
114114 // but at host level.
115115 private val pendingTasksForHost = new HashMap [String , ArrayBuffer [Int ]]
116116
117- // this collection is mainly for ensuring that the NODE_LOCAL task is always scheduled
118- // before NOPREF and it contain all NODE_LOCAL and "not-launched" tasks
119- private [scheduler] val nodeLocalTasks = new HashMap [String , HashSet [Int ]]
117+ // private[scheduler] val nodeLocalTasks = new HashMap[String, HashSet[Int]]
118+ private var hasNodeLocalOnlyTasks = true
120119
121120 // Set of pending tasks for each rack -- similar to the above.
122121 private val pendingTasksForRack = new HashMap [String , ArrayBuffer [Int ]]
@@ -194,7 +193,7 @@ private[spark] class TaskSetManager(
194193 }
195194 addTo(pendingTasksForHost.getOrElseUpdate(loc.host, new ArrayBuffer ))
196195 if (loc.executorId == None ) {
197- nodeLocalTasks.getOrElseUpdate(loc.host, new HashSet [ Int ]) += index
196+ hasNodeLocalOnlyTasks = true
198197 }
199198 for (rack <- sched.getRackForHost(loc.host)) {
200199 addTo(pendingTasksForRack.getOrElseUpdate(rack, new ArrayBuffer ))
@@ -401,7 +400,7 @@ private[spark] class TaskSetManager(
401400 *
402401 * NOTE: this function is either called with a real preferredLocality level which
403402 * would be adjusted by delay scheduling algorithm or it will be with a special
404- * NOPREF locality which will be not modified
403+ * NO_PREF locality which will be not modified
405404 *
406405 * @param execId the executor Id of the offered resource
407406 * @param host the host Id of the offered resource
@@ -418,8 +417,7 @@ private[spark] class TaskSetManager(
418417
419418 var allowedLocality = maxLocality
420419
421- if (maxLocality != TaskLocality .NO_PREF ||
422- (nodeLocalTasks.contains(host) && nodeLocalTasks(host).size > 0 )) {
420+ if (maxLocality != TaskLocality .NO_PREF || hasNodeLocalOnlyTasks) {
423421 allowedLocality = getAllowedLocalityLevel(curTime)
424422 if (allowedLocality > maxLocality) {
425423 // We're not allowed to search for farther-away tasks
@@ -440,7 +438,7 @@ private[spark] class TaskSetManager(
440438 taskInfos(taskId) = info
441439 taskAttempts(index) = info :: taskAttempts(index)
442440 // Update our locality level for delay scheduling
443- // NOPREF will not affect the variables related to delay scheduling
441+ // NO_PREF will not affect the variables related to delay scheduling
444442 if (maxLocality != TaskLocality .NO_PREF ) {
445443 currentLocalityIndex = getLocalityIndex(taskLocality)
446444 lastLaunchTime = curTime
@@ -468,13 +466,13 @@ private[spark] class TaskSetManager(
468466 taskName, taskId, host, taskLocality, serializedTask.limit))
469467
470468 sched.dagScheduler.taskStarted(task, info)
471- if (taskLocality <= TaskLocality .NODE_LOCAL ) {
469+ /* if (taskLocality <= TaskLocality.NODE_LOCAL) {
472470 for (preferedLocality <- tasks(index).preferredLocations) {
473471 if (nodeLocalTasks.contains(preferedLocality.host)) {
474472 nodeLocalTasks(preferedLocality.host) -= index
475473 }
476474 }
477- }
475+ }*/
478476 return Some (new TaskDescription (taskId, execId, taskName, index, serializedTask))
479477 }
480478 case _ =>
0 commit comments