Return-Path: X-Original-To: apmail-spark-reviews-archive@minotaur.apache.org Delivered-To: apmail-spark-reviews-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A327911620 for ; Tue, 2 Sep 2014 22:29:06 +0000 (UTC) Received: (qmail 80292 invoked by uid 500); 2 Sep 2014 22:29:06 -0000 Delivered-To: apmail-spark-reviews-archive@spark.apache.org Received: (qmail 80267 invoked by uid 500); 2 Sep 2014 22:29:06 -0000 Mailing-List: contact reviews-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@spark.apache.org Received: (qmail 80245 invoked by uid 99); 2 Sep 2014 22:29:06 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Sep 2014 22:29:06 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id DCFA09B0BB4; Tue, 2 Sep 2014 22:29:05 +0000 (UTC) From: sryza To: reviews@spark.apache.org Reply-To: reviews@spark.apache.org References: In-Reply-To: Subject: [GitHub] spark pull request: SPARK-1767: Prefer HDFS-cached replicas when s... Content-Type: text/plain Message-Id: <20140902222905.DCFA09B0BB4@tyr.zones.apache.org> Date: Tue, 2 Sep 2014 22:29:05 +0000 (UTC) Github user sryza commented on a diff in the pull request: https://github.com/apache/spark/pull/1486#discussion_r17020666 --- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala --- @@ -1296,7 +1298,25 @@ class DAGScheduler( // If the RDD has some placement preferences (as is the case for input RDDs), get those val rddPrefs = rdd.preferredLocations(rdd.partitions(partition)).toList if (!rddPrefs.isEmpty) { - return rddPrefs.map(host => TaskLocation(host)) + // Use the highest priority locations that we have. + var highestPriority = PartitionPriority.NORMAL + val taskLocations = rddPrefs.foldLeft(List[TaskLocation]()) { + (l, plocStr) => + val ploc = PartitionLocation.fromString(plocStr) + if (ploc.priority > highestPriority) { + highestPriority = ploc.priority + (TaskLocation(ploc.host)) :: Nil + } else if (ploc.priority < highestPriority) { + l + } else { + (TaskLocation(ploc.host)) :: l + } + } + if (highestPriority > PartitionPriority.NORMAL) { + logTrace("Using prioritized location(s): " + taskLocations.map(_.host).mkString(",") + + " which have priority " + highestPriority) --- End diff -- Should be indented two spaces past logTrace. --- 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 infrastructure@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org For additional commands, e-mail: reviews-help@spark.apache.org