-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-10997] [core] Add "client mode" to netty rpc env. #9210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,8 +45,6 @@ private[spark] class CoarseGrainedExecutorBackend( | |
env: SparkEnv) | ||
extends ThreadSafeRpcEndpoint with ExecutorBackend with Logging { | ||
|
||
Utils.checkHostPort(hostPort, "Expected hostport") | ||
|
||
var executor: Executor = null | ||
@volatile var driver: Option[RpcEndpointRef] = None | ||
|
||
|
@@ -80,9 +78,8 @@ private[spark] class CoarseGrainedExecutorBackend( | |
} | ||
|
||
override def receive: PartialFunction[Any, Unit] = { | ||
case RegisteredExecutor => | ||
case RegisteredExecutor(hostname) => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: I'm having to change this because the client doesn't know which hostname the client connection will be created on when the register message is sent. So the server replies it back to the client, so that both agree about what's the actual address being used. |
||
logInfo("Successfully registered with driver") | ||
val (hostname, _) = Utils.parseHostPort(hostPort) | ||
executor = new Executor(executorId, hostname, env, userClassPath, isLocal = false) | ||
|
||
case RegisterExecutorFailed(message) => | ||
|
@@ -163,7 +160,8 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging { | |
hostname, | ||
port, | ||
executorConf, | ||
new SecurityManager(executorConf)) | ||
new SecurityManager(executorConf), | ||
clientMode = true) | ||
val driver = fetcher.setupEndpointRefByURI(driverUrl) | ||
val props = driver.askWithRetry[Seq[(String, String)]](RetrieveSparkProps) ++ | ||
Seq[(String, String)](("spark.app.id", appId)) | ||
|
@@ -188,12 +186,12 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging { | |
val env = SparkEnv.createExecutorEnv( | ||
driverConf, executorId, hostname, port, cores, isLocal = false) | ||
|
||
// SparkEnv sets spark.driver.port so it shouldn't be 0 anymore. | ||
val boundPort = env.conf.getInt("spark.executor.port", 0) | ||
assert(boundPort != 0) | ||
|
||
// Start the CoarseGrainedExecutorBackend endpoint. | ||
val sparkHostPort = hostname + ":" + boundPort | ||
// SparkEnv will set spark.executor.port if the rpc env is listening for incoming | ||
// connections (e.g., if it's using akka). Otherwise, the executor is running in | ||
// client mode only, and does not accept incoming connections. | ||
val sparkHostPort = env.conf.getOption("spark.executor.port").map { port => | ||
hostname + ":" + port | ||
}.orNull | ||
env.rpcEnv.setupEndpoint("Executor", new CoarseGrainedExecutorBackend( | ||
env.rpcEnv, driverUrl, executorId, sparkHostPort, cores, userClassPath, env)) | ||
workerUrl.foreach { url => | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add some comment on what this is checking and when this can happen