-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-24203][core] Make executor's bindAddress configurable #26331
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,7 @@ private[spark] class CoarseGrainedExecutorBackend( | |
| override val rpcEnv: RpcEnv, | ||
| driverUrl: String, | ||
| executorId: String, | ||
| bindAddress: String, | ||
| hostname: String, | ||
| cores: Int, | ||
| userClassPath: Seq[URL], | ||
|
|
@@ -227,6 +228,7 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging { | |
| case class Arguments( | ||
| driverUrl: String, | ||
| executorId: String, | ||
| bindAddress: String, | ||
| hostname: String, | ||
| cores: Int, | ||
| appId: String, | ||
|
|
@@ -238,7 +240,7 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging { | |
| val createFn: (RpcEnv, Arguments, SparkEnv) => | ||
| CoarseGrainedExecutorBackend = { case (rpcEnv, arguments, env) => | ||
| new CoarseGrainedExecutorBackend(rpcEnv, arguments.driverUrl, arguments.executorId, | ||
| arguments.hostname, arguments.cores, arguments.userClassPath, env, | ||
| arguments.bindAddress, arguments.hostname, arguments.cores, arguments.userClassPath, env, | ||
| arguments.resourcesFileOpt) | ||
| } | ||
| run(parseArguments(args, this.getClass.getCanonicalName.stripSuffix("$")), createFn) | ||
|
|
@@ -259,10 +261,12 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging { | |
| val executorConf = new SparkConf | ||
| val fetcher = RpcEnv.create( | ||
| "driverPropsFetcher", | ||
| arguments.bindAddress, | ||
| arguments.hostname, | ||
| -1, | ||
| executorConf, | ||
| new SecurityManager(executorConf), | ||
| numUsableCores = 0, | ||
| clientMode = true) | ||
|
|
||
| var driver: RpcEndpointRef = null | ||
|
|
@@ -297,8 +301,8 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging { | |
| } | ||
|
|
||
| driverConf.set(EXECUTOR_ID, arguments.executorId) | ||
| val env = SparkEnv.createExecutorEnv(driverConf, arguments.executorId, arguments.hostname, | ||
| arguments.cores, cfg.ioEncryptionKey, isLocal = false) | ||
| val env = SparkEnv.createExecutorEnv(driverConf, arguments.executorId, arguments.bindAddress, | ||
| arguments.hostname, arguments.cores, cfg.ioEncryptionKey, isLocal = false) | ||
|
|
||
| env.rpcEnv.setupEndpoint("Executor", backendCreateFn(env.rpcEnv, arguments, env)) | ||
| arguments.workerUrl.foreach { url => | ||
|
|
@@ -311,6 +315,7 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging { | |
| def parseArguments(args: Array[String], classNameForEntry: String): Arguments = { | ||
| var driverUrl: String = null | ||
| var executorId: String = null | ||
| var bindAddress: String = null | ||
| var hostname: String = null | ||
| var cores: Int = 0 | ||
| var resourcesFileOpt: Option[String] = None | ||
|
|
@@ -327,6 +332,9 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging { | |
| case ("--executor-id") :: value :: tail => | ||
| executorId = value | ||
| argv = tail | ||
| case ("--bind-address") :: value :: tail => | ||
| bindAddress = value | ||
| argv = tail | ||
| case ("--hostname") :: value :: tail => | ||
| hostname = value | ||
| argv = tail | ||
|
|
@@ -364,7 +372,11 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging { | |
| printUsageAndExit(classNameForEntry) | ||
| } | ||
|
|
||
| Arguments(driverUrl, executorId, hostname, cores, appId, workerUrl, | ||
| if (bindAddress == null) { | ||
| bindAddress = hostname | ||
|
Member
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. We need a new test case for this code path, @nishchalv .
Author
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. @dongjoon-hyun Added couple of test cases.
Member
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. Thank you! |
||
| } | ||
|
|
||
| Arguments(driverUrl, executorId, bindAddress, hostname, cores, appId, workerUrl, | ||
| userClassPath, resourcesFileOpt) | ||
| } | ||
|
|
||
|
|
@@ -377,6 +389,7 @@ private[spark] object CoarseGrainedExecutorBackend extends Logging { | |
| | Options are: | ||
| | --driver-url <driverUrl> | ||
| | --executor-id <executorId> | ||
| | --bind-address <bindAddress> | ||
| | --hostname <hostname> | ||
| | --cores <cores> | ||
| | --resourcesFile <fileWithJSONResourceInformation> | ||
|
|
||
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.
Do we need this line in this PR?
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.
I think this is needed unless we add extra method in
RpcEnvobject.