Skip to content

Commit

Permalink
Few codes and docs refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
li-zhihui committed Aug 1, 2014
1 parent 41cf47e commit 88c7dc6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, actorSystem: A
private val akkaFrameSize = AkkaUtils.maxFrameSizeBytes(conf)
// Submit tasks only after (registered resources / total expected resources)
// is equal to at least this value, that is double between 0 and 1.
var minRegisteredRatio = conf.getDouble("spark.scheduler.minRegisteredResourcesRatio", 0)
if (minRegisteredRatio > 1) minRegisteredRatio = 1
// Whatever minRegisteredRatio is arrived, submit tasks after the time(milliseconds).
var minRegisteredRatio =
math.min(1, conf.getDouble("spark.scheduler.minRegisteredResourcesRatio", 0))
// Submit tasks after maxRegisteredWaitingTime milliseconds
// if minRegisteredRatio has not yet been reached
val maxRegisteredWaitingTime =
conf.getInt("spark.scheduler.maxRegisteredResourcesWaitingTime", 30000)
val createTime = System.currentTimeMillis()
Expand Down Expand Up @@ -263,10 +264,10 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, actorSystem: A
}
}

def checkRegisteredResources(): Boolean = true
def sufficientResourcesRegistered(): Boolean = true

override def isReady(): Boolean = {
if (checkRegisteredResources) {
if (sufficientResourcesRegistered) {
logInfo("SchedulerBackend is ready for scheduling beginning" +
", total expected resources: " + totalExpectedResources.get() +
", minRegisteredResourcesRatio: " + minRegisteredRatio)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private[spark] class SparkDeploySchedulerBackend(
removeExecutor(fullId.split("/")(1), reason.toString)
}

override def checkRegisteredResources(): Boolean = {
override def sufficientResourcesRegistered(): Boolean = {
totalCoreCount.get() >= totalExpectedResources.get() * minRegisteredRatio
}
}
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ Apart from these, the following properties are also available, and may be useful
<td>0</td>
<td>
The minimum ratio of registered resources (registered resources / total expected resources)
(resources are executors in yarn mode, CPU cores in standalone and mesos mode)
(resources are executors in yarn mode, CPU cores in standalone mode)
to wait for before scheduling begins. Specified as a double between 0 and 1.
Regardless of whether the minimum ratio of resources has been reached,
the maximum amount of time it will wait before scheduling begins is controlled by config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private[spark] class YarnClientSchedulerBackend(
logInfo("Stopped")
}

override def checkRegisteredResources(): Boolean = {
override def sufficientResourcesRegistered(): Boolean = {
totalExecutors.get() >= totalExpectedResources.get() * minRegisteredRatio
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private[spark] class YarnClusterSchedulerBackend(
totalExpectedResources.set(numExecutors)
}

override def checkRegisteredResources(): Boolean = {
override def sufficientResourcesRegistered(): Boolean = {
totalExecutors.get() >= totalExpectedResources.get() * minRegisteredRatio
}
}

0 comments on commit 88c7dc6

Please sign in to comment.