Github user mateiz commented on a diff in the pull request:
https://github.com/apache/spark/pull/1313#discussion_r15508307
--- Diff:
core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
@@ -341,20 +346,31 @@ private[spark] class TaskSetManager(
*
* @return An option containing (task index within the task set,
locality, is speculative?)
*/
- private def findTask(execId: String, host: String, locality:
TaskLocality.Value)
- : Option[(Int, TaskLocality.Value, Boolean)] =
+ private def findTask(execId: String, host: String, maxLocality:
TaskLocality.Value)
+ : Option[(Int, TaskLocality.Value, Boolean)] =
{
for (index <- findTaskFromList(execId,
getPendingTasksForExecutor(execId))) {
return Some((index, TaskLocality.PROCESS_LOCAL, false))
}
- if (TaskLocality.isAllowed(locality, TaskLocality.NODE_LOCAL)) {
+ if (TaskLocality.isAllowed(maxLocality, TaskLocality.NODE_LOCAL)) {
for (index <- findTaskFromList(execId,
getPendingTasksForHost(host))) {
return Some((index, TaskLocality.NODE_LOCAL, false))
}
}
- if (TaskLocality.isAllowed(locality, TaskLocality.RACK_LOCAL)) {
+ if (TaskLocality.isAllowed(maxLocality, TaskLocality.NOPREF)) {
+ // Look for noPref tasks after NODE_LOCAL for minimize cross-rack
traffic
+ for (index <- findTaskFromList(execId, pendingTasksWithNoPrefs)) {
+ return Some((index, TaskLocality.PROCESS_LOCAL, false))
+ }
+ // find a speculative task if all noPref tasks have been scheduled
--- End diff --
Why are speculative tasks here instead of at the end of the method? It
seems we don't need to change that code path. In particular, some speculative
tasks may have process locality and such, so we want them to launch before we
assign that node for other tasks.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---