Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ private[spark] class ExecutorAllocationManager(
* yarn-client mode when AM re-registers after a failure.
*/
def reset(): Unit = synchronized {
initializing = true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jerryshao @vanzin
I think that deleting the initializing = true is a good idea.

numExecutorsTarget = initialNumExecutors
numExecutorsToAdd = 1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,17 @@ class ExecutorAllocationManagerSuite
assert(maxNumExecutorsNeeded(manager) === 1)
}

test("SPARK-20079: Re registration of AM hangs spark cluster in yarn-client mode") {
sc = createSparkContext()
val manager = sc.executorAllocationManager.get
assert(initializing(manager))
val stageInfo = createStageInfo(0, 2)
sc.listenerBus.postToAll(SparkListenerStageSubmitted(stageInfo))
assert(!initializing(manager))
manager.reset()
assert(!initializing(manager))
}

test("reset the state of allocation manager") {
sc = createSparkContext()
val manager = sc.executorAllocationManager.get
Expand Down Expand Up @@ -988,6 +999,7 @@ private object ExecutorAllocationManagerSuite extends PrivateMethodTester {
| Helper methods for accessing private methods and fields |
* ------------------------------------------------------- */

private val _initializing = PrivateMethod[Boolean]('initializing)
private val _numExecutorsToAdd = PrivateMethod[Int]('numExecutorsToAdd)
private val _numExecutorsTarget = PrivateMethod[Int]('numExecutorsTarget)
private val _maxNumExecutorsNeeded = PrivateMethod[Int]('maxNumExecutorsNeeded)
Expand All @@ -1011,6 +1023,10 @@ private object ExecutorAllocationManagerSuite extends PrivateMethodTester {
private val _localityAwareTasks = PrivateMethod[Int]('localityAwareTasks)
private val _hostToLocalTaskCount = PrivateMethod[Map[String, Int]]('hostToLocalTaskCount)

private def initializing(manager: ExecutorAllocationManager): Boolean = {
manager invokePrivate _initializing()
}

private def numExecutorsToAdd(manager: ExecutorAllocationManager): Int = {
manager invokePrivate _numExecutorsToAdd()
}
Expand Down