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 7CAA610264 for ; Wed, 4 Feb 2015 07:07:20 +0000 (UTC) Received: (qmail 48455 invoked by uid 500); 4 Feb 2015 07:07:21 -0000 Delivered-To: apmail-spark-reviews-archive@spark.apache.org Received: (qmail 48429 invoked by uid 500); 4 Feb 2015 07:07:21 -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 48418 invoked by uid 99); 4 Feb 2015 07:07:20 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Feb 2015 07:07:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D7385E01CE; Wed, 4 Feb 2015 07:07:20 +0000 (UTC) From: markhamstra To: reviews@spark.apache.org Reply-To: reviews@spark.apache.org References: In-Reply-To: Subject: [GitHub] spark pull request: [SPARK-4939] move to next locality when no pen... Content-Type: text/plain Message-Id: <20150204070720.D7385E01CE@git1-us-west.apache.org> Date: Wed, 4 Feb 2015 07:07:20 +0000 (UTC) Github user markhamstra commented on a diff in the pull request: https://github.com/apache/spark/pull/3779#discussion_r24066157 --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala --- @@ -506,13 +506,59 @@ private[spark] class TaskSetManager( * Get the level we can launch tasks according to delay scheduling, based on current wait time. */ private def getAllowedLocalityLevel(curTime: Long): TaskLocality.TaskLocality = { - while (curTime - lastLaunchTime >= localityWaits(currentLocalityIndex) && - currentLocalityIndex < myLocalityLevels.length - 1) - { - // Jump to the next locality level, and remove our waiting time for the current one since - // we don't want to count it again on the next one - lastLaunchTime += localityWaits(currentLocalityIndex) - currentLocalityIndex += 1 + // Remove the scheduled or finished tasks lazily + def hasNotScheduledTasks(taskIndexes: ArrayBuffer[Int]): Boolean = { + var indexOffset = taskIndexes.size + while (indexOffset > 0) { + indexOffset -= 1 + val index = taskIndexes(indexOffset) + if (copiesRunning(index) == 0 && !successful(index)) { + return true + } else { + taskIndexes.remove(indexOffset) + } + } + false + } + // It removes the empty lists after check + def hasMoreTasks(pendingTasks: HashMap[String, ArrayBuffer[Int]]): Boolean = { + val emptyKeys = new ArrayBuffer[String] + val hasTasks = pendingTasks.exists{ + case (id: String, tasks: ArrayBuffer[Int]) => + if (hasNotScheduledTasks(tasks)) { + true + } else { + emptyKeys += id --- End diff -- id ==> executorId --- 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