Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b34ec0c
make master support multiple executors per worker
CodingCat May 4, 2014
a5d629a
java doc
CodingCat Jan 27, 2015
a26096d
stylistic fix
CodingCat Jan 27, 2015
e5efabb
more java docs and consolidate canUse function
CodingCat Jan 27, 2015
ec7d421
test commit
CodingCat Jan 27, 2015
5b81466
remove outdated comments
CodingCat Jan 27, 2015
19d3da7
address the comments
CodingCat Feb 22, 2015
0b64fea
fix compilation issue
CodingCat Feb 22, 2015
35c462c
address Andrew's comments
CodingCat Feb 22, 2015
387f4ec
bug fix
CodingCat Feb 23, 2015
f64a28d
typo fix
CodingCat Feb 23, 2015
878402c
change the launching executor code
CodingCat Feb 23, 2015
497ec2c
address andrew's comments
CodingCat Mar 27, 2015
2c2bcc5
fix wrong usage info
CodingCat Mar 27, 2015
ff011e2
start multiple executors on the worker by rewriting startExeuctor logic
CodingCat Apr 5, 2015
4cf61f1
improve the code and docs
CodingCat Apr 5, 2015
63b3df9
change the description of the parameter in the submit script
CodingCat Apr 5, 2015
f595bd6
recover some unintentional changes
CodingCat Apr 5, 2015
d9c1685
remove unused var
CodingCat Apr 5, 2015
f035423
stylistic fix
CodingCat Apr 5, 2015
12a1b32
change the semantic of coresPerExecutor to exact core number
CodingCat Apr 9, 2015
2eeff77
stylistic fixes
CodingCat Apr 10, 2015
45967b4
remove unused method
CodingCat Apr 10, 2015
b8ca561
revert a change
CodingCat Apr 10, 2015
940cb42
avoid unnecessary allocation
CodingCat Apr 10, 2015
fbeb7e5
address the comments
CodingCat Apr 14, 2015
6dee808
change filter predicate
CodingCat Apr 14, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more java docs and consolidate canUse function
  • Loading branch information
CodingCat committed Apr 9, 2015
commit e5efabb580780c435a262b53d66dab376140251e
25 changes: 17 additions & 8 deletions core/src/main/scala/org/apache/spark/deploy/master/Master.scala
Original file line number Diff line number Diff line change
Expand Up @@ -529,12 +529,20 @@ private[master] class Master(
* two executors on the same worker).
*/
private def canUse(app: ApplicationInfo, worker: WorkerInfo): Boolean = {
worker.memoryFree >= app.desc.memoryPerExecutorMB && !worker.hasExecutor(app) &&
worker.coresFree > 0
val enoughResources = worker.memoryFree >= app.desc.memoryPerExecutorMB && worker.coresFree > 0
val allowMultipleExecutors = app.desc.maxCorePerExecutor.isDefined || !worker.hasExecutor(app)
allowMultipleExecutors && enoughResources
}

// Right now this is a very simple FIFO scheduler. We keep trying to fit in the first app
// in the queue, then the second app, etc.
/**
* This functions starts only one executor on each worker.
*
* It travers the available worker list. In spreadOutApps mode, it allocates at most
* 1 core and app.desc.memoryPerExecutorMB megabytes memory and tracks the resource allocation
* in a 1-d array for each visit; Otherwise, it allocates 1 core and app.desc.memoryPerExecutorMB
* megabytes to each executor but starts as many executors as possible (limited by the worker
* resources) for each visit.
*/
private def startSingleExecutorPerWorker() {
if (spreadOutApps) {
// Try to spread out each app among all the nodes, until it has all its cores
Expand Down Expand Up @@ -587,16 +595,17 @@ private[master] class Master(
* It traverses the available worker list. In spreadOutApps mode, it allocates at most
* spark.executor.maxCoreNumPerExecutor cores (can be less than it when the worker does not have
* enough cores or the demand is less than it) and app.desc.memoryPerExecutorMB megabytes memory
* and tracks the resource allocation in a 2d array for each visit; Otherwise, it uses up all
* available resources of a worker for each visit.
* and tracks the resource allocation in a 2d array for each visit; Otherwise, it allocates at
* most spark.executor.maxCoreNumPerExecutor cores and app.desc.memoryPerExecutorMB megabytes
* to each executor but starts as many executors as possible (limited by the worker resources) for
* each visit.
*/
private def startMultiExecutorsPerWorker() {
if (spreadOutApps) {
for (app <- waitingApps if app.coresLeft > 0) {
val memoryPerExecutor = app.desc.memoryPerExecutorMB
val usableWorkers = workers.filter(_.state == WorkerState.ALIVE).
filter(worker => worker.coresFree > 0 && worker.memoryFree >= memoryPerExecutor).toArray.
sortBy(_.memoryFree / memoryPerExecutor).reverse
filter(canUse(app, _)).toArray.sortBy(_.memoryFree / memoryPerExecutor).reverse
val maxCoreNumPerExecutor = app.desc.maxCorePerExecutor.get
// get the maximum number of executors we can assign
var leftExecutorNumToAssign = usableWorkers.map(_.memoryFree / memoryPerExecutor).sum
Expand Down