Skip to content

Commit

Permalink
[HOTFIX][SPARK-4136] Fix compilation and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Or committed Feb 10, 2015
1 parent 8b7587a commit 4e3aa68
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ private[spark] trait ExecutorAllocationClient {
/**
* Express a preference to the cluster manager for a given total number of executors.
* This can result in canceling pending requests or filing additional requests.
* Return whether the request is acknowledged by the cluster manager.
* @return whether the request is acknowledged by the cluster manager.
*/
private[spark] def requestTotalExecutors(numExecutors: Int): Boolean

/**
* Request an additional number of executors from the cluster manager.
* Return whether the request is acknowledged by the cluster manager.
* @return whether the request is acknowledged by the cluster manager.
*/
def requestExecutors(numAdditionalExecutors: Int): Boolean

/**
* Request that the cluster manager kill the specified executors.
* Return whether the request is acknowledged by the cluster manager.
* @return whether the request is acknowledged by the cluster manager.
*/
def killExecutors(executorIds: Seq[String]): Boolean

/**
* Request that the cluster manager kill the specified executor.
* Return whether the request is acknowledged by the cluster manager.
* @return whether the request is acknowledged by the cluster manager.
*/
def killExecutor(executorId: String): Boolean = killExecutors(Seq(executorId))
}
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class CoarseGrainedSchedulerBackend(scheduler: TaskSchedulerImpl, val actorSyste
* @return whether the request is acknowledged.
*/
final override def requestTotalExecutors(numExecutors: Int): Boolean = synchronized {
if (numAdditionalExecutors < 0) {
if (numExecutors < 0) {
throw new IllegalArgumentException(
"Attempted to request a negative number of executor(s) " +
s"$numExecutors from the cluster manager. Please specify a positive number!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,25 +297,23 @@ class ExecutorAllocationManagerSuite extends FunSuite with LocalSparkContext {
assert(removeExecutor(manager, "5"))
assert(removeExecutor(manager, "6"))
assert(executorIds(manager).size === 10)
assert(addExecutors(manager) === 0) // still at upper limit
assert(addExecutors(manager) === 1)
onExecutorRemoved(manager, "3")
onExecutorRemoved(manager, "4")
assert(executorIds(manager).size === 8)

// Add succeeds again, now that we are no longer at the upper limit
// Number of executors added restarts at 1
assert(addExecutors(manager) === 1)
assert(addExecutors(manager) === 1) // upper limit reached again
assert(addExecutors(manager) === 2)
assert(addExecutors(manager) === 1) // upper limit reached
assert(addExecutors(manager) === 0)
assert(executorIds(manager).size === 8)
onExecutorRemoved(manager, "5")
onExecutorRemoved(manager, "6")
onExecutorAdded(manager, "13")
onExecutorAdded(manager, "14")
assert(executorIds(manager).size === 8)
assert(addExecutors(manager) === 1)
assert(addExecutors(manager) === 1) // upper limit reached again
assert(addExecutors(manager) === 0)
assert(addExecutors(manager) === 0) // still at upper limit
onExecutorAdded(manager, "15")
onExecutorAdded(manager, "16")
assert(executorIds(manager).size === 10)
Expand Down

0 comments on commit 4e3aa68

Please sign in to comment.