Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/17882#discussion_r122335403
--- Diff:
resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala
---
@@ -358,14 +358,26 @@ private[spark] class ApplicationMaster(
dummyRunner.launchContextDebugInfo()
}
+ /**
+ * (executorIdCounter, requestExecutors) should be the initial state
+ * or the last state AM restart.
+ *
+ * @see SPARK-12864, SPARK-20079
+ */
+ val (executorIdCounter, requestExecutors) =
+ driverRef.askSync[(Int, RequestExecutors)](GetAMInitialState)
allocator = client.register(driverUrl,
driverRef,
yarnConf,
_sparkConf,
uiAddress,
historyAddress,
securityMgr,
- localResources)
+ localResources,
+ executorIdCounter)
+ if (requestExecutors.requestedTotal !=
allocator.getTargetNumExecutors) {
+ amEndpoint.send(requestExecutors)
--- End diff --
This doesn't work; because you're using `send`, the handler would have to
be in the `receive` method of the endpoint, and it's actually in
`receiveAndReply` (which is the handler for `ask`).
You have to call `requestTotalExecutorsWithPreferredLocalities` directly
here, or make that method take a `RequestExecutors` message as an argument, but
you shouldn't go through the RPC system just to make a method call.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]