You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by pw...@apache.org on 2013/10/15 07:26:59 UTC

[13/37] git commit: Merge remote-tracking branch 'origin' into kill

Merge remote-tracking branch 'origin' into kill

Conflicts:
	core/src/main/scala/org/apache/spark/scheduler/TaskScheduler.scala
	core/src/main/scala/org/apache/spark/scheduler/cluster/ClusterTaskSetManager.scala
	core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala


Project: http://git-wip-us.apache.org/repos/asf/incubator-spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spark/commit/1c48ba0d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spark/tree/1c48ba0d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spark/diff/1c48ba0d

Branch: refs/heads/master
Commit: 1c48ba0d9f25b6f59ea00ba0814930a840b635ad
Parents: 1d87616 714fdab
Author: Reynold Xin <rx...@apache.org>
Authored: Wed Oct 2 16:40:44 2013 -0700
Committer: Reynold Xin <rx...@apache.org>
Committed: Wed Oct 2 16:40:44 2013 -0700

----------------------------------------------------------------------
 assembly/pom.xml                                |   2 +-
 bagel/pom.xml                                   |   2 +-
 core/pom.xml                                    |   2 +-
 .../scala/org/apache/spark/SparkContext.scala   |  11 +-
 .../org/apache/spark/api/java/JavaRDDLike.scala |  10 +
 .../main/scala/org/apache/spark/rdd/RDD.scala   |  38 +-
 .../apache/spark/scheduler/DAGScheduler.scala   |   1 -
 .../spark/scheduler/DAGSchedulerEvent.scala     |   1 -
 .../org/apache/spark/scheduler/JobLogger.scala  |   1 -
 .../scala/org/apache/spark/scheduler/Pool.scala | 121 +++++++
 .../apache/spark/scheduler/Schedulable.scala    |  48 +++
 .../spark/scheduler/SchedulableBuilder.scala    | 157 +++++++++
 .../spark/scheduler/SchedulingAlgorithm.scala   |  81 +++++
 .../apache/spark/scheduler/SchedulingMode.scala |  29 ++
 .../apache/spark/scheduler/SparkListener.scala  |   1 -
 .../org/apache/spark/scheduler/StageInfo.scala  |   2 +-
 .../spark/scheduler/TaskDescription.scala       |  37 ++
 .../org/apache/spark/scheduler/TaskInfo.scala   |  72 ++++
 .../apache/spark/scheduler/TaskLocality.scala   |  32 ++
 .../apache/spark/scheduler/TaskScheduler.scala  |   4 +-
 .../spark/scheduler/TaskSchedulerListener.scala |   1 -
 .../apache/spark/scheduler/TaskSetManager.scala |  50 +++
 .../scheduler/cluster/ClusterScheduler.scala    |   2 +-
 .../cluster/ClusterTaskSetManager.scala         |   8 +-
 .../apache/spark/scheduler/cluster/Pool.scala   | 121 -------
 .../spark/scheduler/cluster/Schedulable.scala   |  48 ---
 .../scheduler/cluster/SchedulableBuilder.scala  | 144 --------
 .../scheduler/cluster/SchedulingAlgorithm.scala |  81 -----
 .../scheduler/cluster/SchedulingMode.scala      |  29 --
 .../cluster/StandaloneClusterMessage.scala      |   1 +
 .../cluster/StandaloneSchedulerBackend.scala    |   1 +
 .../scheduler/cluster/TaskDescription.scala     |  37 --
 .../spark/scheduler/cluster/TaskInfo.scala      |  72 ----
 .../spark/scheduler/cluster/TaskLocality.scala  |  32 --
 .../scheduler/cluster/TaskSetManager.scala      |  51 ---
 .../mesos/CoarseMesosSchedulerBackend.scala     | 286 +++++++++++++++
 .../cluster/mesos/MesosSchedulerBackend.scala   | 345 +++++++++++++++++++
 .../spark/scheduler/local/LocalScheduler.scala  |   3 +-
 .../scheduler/local/LocalTaskSetManager.scala   |   4 +-
 .../mesos/CoarseMesosSchedulerBackend.scala     | 286 ---------------
 .../scheduler/mesos/MesosSchedulerBackend.scala | 343 ------------------
 .../org/apache/spark/storage/MemoryStore.scala  |  14 +-
 .../apache/spark/ui/UIWorkloadGenerator.scala   |   2 +-
 .../org/apache/spark/ui/exec/ExecutorsUI.scala  |   2 +-
 .../org/apache/spark/ui/jobs/IndexPage.scala    |   2 +-
 .../spark/ui/jobs/JobProgressListener.scala     |   4 +-
 .../apache/spark/ui/jobs/JobProgressUI.scala    |   4 +-
 .../org/apache/spark/ui/jobs/PoolTable.scala    |   3 +-
 .../org/apache/spark/ui/jobs/StagePage.scala    |   6 +-
 .../org/apache/spark/ui/jobs/StageTable.scala   |   3 +-
 .../org/apache/spark/LocalSparkContext.scala    |  10 +-
 .../org/apache/spark/SharedSparkContext.scala   |   6 +-
 .../scala/org/apache/spark/ThreadingSuite.scala |  45 ++-
 .../scala/org/apache/spark/rdd/RDDSuite.scala   |  39 ++-
 .../spark/scheduler/DAGSchedulerSuite.scala     |   7 +-
 docs/_config.yml                                |   4 +-
 ec2/spark_ec2.py                                | 114 ++++--
 examples/pom.xml                                |   2 +-
 mllib/pom.xml                                   |   2 +-
 pom.xml                                         |   3 +-
 project/SparkBuild.scala                        |   4 +-
 python/pyspark/shell.py                         |   2 +-
 repl-bin/pom.xml                                |   2 +-
 repl/pom.xml                                    |   2 +-
 .../org/apache/spark/repl/SparkILoop.scala      |   2 +-
 spark-class                                     |  12 +-
 streaming/pom.xml                               |   2 +-
 tools/pom.xml                                   |   2 +-
 yarn/pom.xml                                    |   2 +-
 .../org/apache/spark/deploy/yarn/Client.scala   |   5 +-
 .../spark/deploy/yarn/WorkerRunnable.scala      |   5 +-
 71 files changed, 1538 insertions(+), 1371 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/1c48ba0d/core/src/main/scala/org/apache/spark/SparkContext.scala
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/1c48ba0d/core/src/main/scala/org/apache/spark/rdd/RDD.scala
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/1c48ba0d/core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/1c48ba0d/core/src/main/scala/org/apache/spark/scheduler/DAGSchedulerEvent.scala
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/1c48ba0d/core/src/main/scala/org/apache/spark/scheduler/SchedulableBuilder.scala
----------------------------------------------------------------------
diff --cc core/src/main/scala/org/apache/spark/scheduler/SchedulableBuilder.scala
index 0000000,4e25086..c4f555b
mode 000000,100644..100644
--- a/core/src/main/scala/org/apache/spark/scheduler/SchedulableBuilder.scala
+++ b/core/src/main/scala/org/apache/spark/scheduler/SchedulableBuilder.scala
@@@ -1,0 -1,150 +1,157 @@@
+ /*
+  * Licensed to the Apache Software Foundation (ASF) under one or more
+  * contributor license agreements.  See the NOTICE file distributed with
+  * this work for additional information regarding copyright ownership.
+  * The ASF licenses this file to You under the Apache License, Version 2.0
+  * (the "License"); you may not use this file except in compliance with
+  * the License.  You may obtain a copy of the License at
+  *
+  *    http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+ 
+ package org.apache.spark.scheduler
+ 
+ import java.io.{FileInputStream, InputStream}
+ import java.util.{NoSuchElementException, Properties}
+ 
+ import org.apache.spark.Logging
+ 
+ import scala.xml.XML
+ 
+ /**
+  * An interface to build Schedulable tree
+  * buildPools: build the tree nodes(pools)
+  * addTaskSetManager: build the leaf nodes(TaskSetManagers)
+  */
+ private[spark] trait SchedulableBuilder {
++  def rootPool: Pool
++
+   def buildPools()
++
+   def addTaskSetManager(manager: Schedulable, properties: Properties)
++
++  def getTaskSetManagers(stageId: Int): Iterable[Schedulable] = {
++    rootPool.schedulableQueue.filter(_.stageId == stageId)
++  }
+ }
+ 
+ private[spark] class FIFOSchedulableBuilder(val rootPool: Pool)
+   extends SchedulableBuilder with Logging {
+ 
+   override def buildPools() {
+     // nothing
+   }
+ 
+   override def addTaskSetManager(manager: Schedulable, properties: Properties) {
+     rootPool.addSchedulable(manager)
+   }
+ }
+ 
+ private[spark] class FairSchedulableBuilder(val rootPool: Pool)
+   extends SchedulableBuilder with Logging {
+ 
+   val schedulerAllocFile = Option(System.getProperty("spark.scheduler.allocation.file"))
+   val DEFAULT_SCHEDULER_FILE = "fairscheduler.xml"
+   val FAIR_SCHEDULER_PROPERTIES = "spark.scheduler.pool"
+   val DEFAULT_POOL_NAME = "default"
+   val MINIMUM_SHARES_PROPERTY = "minShare"
+   val SCHEDULING_MODE_PROPERTY = "schedulingMode"
+   val WEIGHT_PROPERTY = "weight"
+   val POOL_NAME_PROPERTY = "@name"
+   val POOLS_PROPERTY = "pool"
+   val DEFAULT_SCHEDULING_MODE = SchedulingMode.FIFO
+   val DEFAULT_MINIMUM_SHARE = 0
+   val DEFAULT_WEIGHT = 1
+ 
+   override def buildPools() {
+     var is: Option[InputStream] = None
+     try {
+       is = Option {
+         schedulerAllocFile.map { f =>
+           new FileInputStream(f)
+         }.getOrElse {
+           getClass.getClassLoader.getResourceAsStream(DEFAULT_SCHEDULER_FILE)
+         }
+       }
+ 
+       is.foreach { i => buildFairSchedulerPool(i) }
+     } finally {
+       is.foreach(_.close())
+     }
+ 
+     // finally create "default" pool
+     buildDefaultPool()
+   }
+ 
+   private def buildDefaultPool() {
+     if (rootPool.getSchedulableByName(DEFAULT_POOL_NAME) == null) {
+       val pool = new Pool(DEFAULT_POOL_NAME, DEFAULT_SCHEDULING_MODE,
+         DEFAULT_MINIMUM_SHARE, DEFAULT_WEIGHT)
+       rootPool.addSchedulable(pool)
+       logInfo("Created default pool %s, schedulingMode: %s, minShare: %d, weight: %d".format(
+         DEFAULT_POOL_NAME, DEFAULT_SCHEDULING_MODE, DEFAULT_MINIMUM_SHARE, DEFAULT_WEIGHT))
+     }
+   }
+ 
+   private def buildFairSchedulerPool(is: InputStream) {
+     val xml = XML.load(is)
+     for (poolNode <- (xml \\ POOLS_PROPERTY)) {
+ 
+       val poolName = (poolNode \ POOL_NAME_PROPERTY).text
+       var schedulingMode = DEFAULT_SCHEDULING_MODE
+       var minShare = DEFAULT_MINIMUM_SHARE
+       var weight = DEFAULT_WEIGHT
+ 
+       val xmlSchedulingMode = (poolNode \ SCHEDULING_MODE_PROPERTY).text
+       if (xmlSchedulingMode != "") {
+         try {
+           schedulingMode = SchedulingMode.withName(xmlSchedulingMode)
+         } catch {
+           case e: NoSuchElementException =>
+             logWarning("Error xml schedulingMode, using default schedulingMode")
+         }
+       }
+ 
+       val xmlMinShare = (poolNode \ MINIMUM_SHARES_PROPERTY).text
+       if (xmlMinShare != "") {
+         minShare = xmlMinShare.toInt
+       }
+ 
+       val xmlWeight = (poolNode \ WEIGHT_PROPERTY).text
+       if (xmlWeight != "") {
+         weight = xmlWeight.toInt
+       }
+ 
+       val pool = new Pool(poolName, schedulingMode, minShare, weight)
+       rootPool.addSchedulable(pool)
+       logInfo("Created pool %s, schedulingMode: %s, minShare: %d, weight: %d".format(
+         poolName, schedulingMode, minShare, weight))
+     }
+   }
+ 
+   override def addTaskSetManager(manager: Schedulable, properties: Properties) {
+     var poolName = DEFAULT_POOL_NAME
+     var parentPool = rootPool.getSchedulableByName(poolName)
+     if (properties != null) {
+       poolName = properties.getProperty(FAIR_SCHEDULER_PROPERTIES, DEFAULT_POOL_NAME)
+       parentPool = rootPool.getSchedulableByName(poolName)
+       if (parentPool == null) {
+         // we will create a new pool that user has configured in app
+         // instead of being defined in xml file
+         parentPool = new Pool(poolName, DEFAULT_SCHEDULING_MODE,
+           DEFAULT_MINIMUM_SHARE, DEFAULT_WEIGHT)
+         rootPool.addSchedulable(parentPool)
+         logInfo("Created pool %s, schedulingMode: %s, minShare: %d, weight: %d".format(
+           poolName, DEFAULT_SCHEDULING_MODE, DEFAULT_MINIMUM_SHARE, DEFAULT_WEIGHT))
+       }
+     }
+     parentPool.addSchedulable(manager)
+     logInfo("Added task set " + manager.name + " tasks to pool "+poolName)
+   }
+ }

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/1c48ba0d/core/src/main/scala/org/apache/spark/scheduler/TaskScheduler.scala
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/1c48ba0d/core/src/main/scala/org/apache/spark/scheduler/cluster/ClusterScheduler.scala
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/1c48ba0d/core/src/main/scala/org/apache/spark/scheduler/cluster/ClusterTaskSetManager.scala
----------------------------------------------------------------------
diff --cc core/src/main/scala/org/apache/spark/scheduler/cluster/ClusterTaskSetManager.scala
index d701c1c,411e49b..5ffe5da
--- a/core/src/main/scala/org/apache/spark/scheduler/cluster/ClusterTaskSetManager.scala
+++ b/core/src/main/scala/org/apache/spark/scheduler/cluster/ClusterTaskSetManager.scala
@@@ -25,15 -25,12 +25,11 @@@ import scala.collection.mutable.HashMa
  import scala.collection.mutable.HashSet
  import scala.math.max
  import scala.math.min
 -import scala.Some
  
- import org.apache.spark.{FetchFailed, Logging, Resubmitted, SparkEnv, Success, TaskEndReason, TaskState}
- import org.apache.spark.{ExceptionFailure, SparkException, TaskResultTooBigFailure, TaskKilled}
+ import org.apache.spark.{ExceptionFailure, FetchFailed, Logging, Resubmitted, SparkEnv,
 -  SparkException, Success, TaskEndReason, TaskResultTooBigFailure, TaskState}
++  SparkException, Success, TaskEndReason, TaskResultTooBigFailure, TaskState, TaskKilled}
  import org.apache.spark.TaskState.TaskState
  import org.apache.spark.scheduler._
- import scala.Some
- import org.apache.spark.FetchFailed
- import org.apache.spark.ExceptionFailure
- import org.apache.spark.TaskResultTooBigFailure
  import org.apache.spark.util.{SystemClock, Clock}
  
  

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/1c48ba0d/core/src/main/scala/org/apache/spark/scheduler/cluster/StandaloneClusterMessage.scala
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/1c48ba0d/core/src/main/scala/org/apache/spark/scheduler/cluster/StandaloneSchedulerBackend.scala
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/1c48ba0d/core/src/main/scala/org/apache/spark/scheduler/local/LocalScheduler.scala
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-spark/blob/1c48ba0d/core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala
----------------------------------------------------------------------
diff --cc core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala
index f39e863,9ed591e..6643c9d
--- a/core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala
+++ b/core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala
@@@ -22,6 -22,6 +22,7 @@@ import scala.collection.mutable.{Map, H
  import org.scalatest.FunSuite
  import org.scalatest.BeforeAndAfter
  
++import org.apache.spark.FetchFailed
  import org.apache.spark.LocalSparkContext
  import org.apache.spark.MapOutputTracker
  import org.apache.spark.rdd.RDD
@@@ -29,13 -29,12 +30,9 @@@ import org.apache.spark.SparkContex
  import org.apache.spark.Partition
  import org.apache.spark.TaskContext
  import org.apache.spark.{Dependency, ShuffleDependency, OneToOneDependency}
 -import org.apache.spark.{FetchFailed, Success, TaskEndReason}
 +import org.apache.spark.{Success, TaskEndReason}
  import org.apache.spark.storage.{BlockManagerId, BlockManagerMaster}
--
- import org.apache.spark.scheduler.cluster.Pool
- import org.apache.spark.scheduler.cluster.SchedulingMode
- import org.apache.spark.scheduler.cluster.SchedulingMode.SchedulingMode
- import org.apache.spark.FetchFailed
 -import org.apache.spark.scheduler.Pool
 -import org.apache.spark.scheduler.SchedulingMode
+ import org.apache.spark.scheduler.SchedulingMode.SchedulingMode
  
  /**
   * Tests for DAGScheduler. These tests directly call the event processing functions in DAGScheduler