Skip to content
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -543,21 +543,22 @@ private[spark] class TaskSetManager(
case TaskLocality.NO_PREF => pendingTasksWithNoPrefs.nonEmpty
case TaskLocality.RACK_LOCAL => moreTasksToRunIn(pendingTasksForRack)
}
val previousLocalityIndex = currentLocalityIndex
if (!moreTasks) {
// This is a performance optimization: if there are no more tasks that can
// be scheduled at a particular locality level, there is no point in waiting
// for the locality wait timeout (SPARK-4939).
lastLaunchTime = curTime
logDebug(s"No tasks for locality level ${myLocalityLevels(currentLocalityIndex)}, " +
s"so moving to locality level ${myLocalityLevels(currentLocalityIndex + 1)}")
currentLocalityIndex += 1
logDebug(s"No tasks for locality level ${myLocalityLevels(previousLocalityIndex)}, " +
s"so moving to locality level ${myLocalityLevels(currentLocalityIndex)}")
} else if (curTime - lastLaunchTime >= localityWaits(currentLocalityIndex)) {
// Jump to the next locality level, and reset lastLaunchTime so that the next locality
// wait timer doesn't immediately expire
lastLaunchTime += localityWaits(currentLocalityIndex)
currentLocalityIndex += 1
logDebug(s"Moving to ${myLocalityLevels(currentLocalityIndex)} after waiting for " +
s"${localityWaits(currentLocalityIndex)}ms")
s"${localityWaits(previousLocalityIndex)}ms")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah OK, not quite what I meant. But, how about a slightly different idea. To match how the debug statement above works, leave it as-is, but then make this one:

logDebug(s"Moving to ${myLocalityLevels(currentLocalityIndex+1)} after waiting for " +                
  s"${localityWaits(currentLocalityIndex)}ms")
currentLocalityIndex += 1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh,I got it ,thank you for help.

} else {
return myLocalityLevels(currentLocalityIndex)
}
Expand Down