-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-5006][Deploy]spark.port.maxRetries doesn't work #3841
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 2 commits
62ec336
191face
396c226
29b751b
f450cd1
67bcb46
bc6e1ec
61a370d
7cdfd98
2d86d65
8cdf96d
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 |
|---|---|---|
|
|
@@ -372,5 +372,5 @@ private[spark] object SparkConf { | |
| /** | ||
| * Return whether the given config is a Spark port config. | ||
| */ | ||
| def isSparkPortConf(name: String): Boolean = name.startsWith("spark.") && name.endsWith(".port") | ||
| def isSparkPortConf(name: String): Boolean = name.startsWith("spark.") && name.contains(".port") | ||
|
Contributor
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. you are misunderstanding what this method does. It looks for
Contributor
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. We should send
Contributor
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. I understand that, but this currently matches something like
Contributor
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. Ok, I changed but used a more obvious way. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,6 +176,10 @@ class SparkContext(config: SparkConf) extends Logging with ExecutorAllocationCli | |
| logInfo(s"Running Spark version $SPARK_VERSION") | ||
|
|
||
| private[spark] val conf = config.clone() | ||
| val portRetriesConf = conf.getOption("spark.port.maxRetries") | ||
|
||
| if (portRetriesConf.isDefined) { | ||
| System.setProperty("spark.port.maxRetries", portRetriesConf.get) | ||
|
||
| } | ||
| conf.validateSettings() | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1691,15 +1691,12 @@ private[spark] object Utils extends Logging { | |
| /** | ||
| * Default maximum number of retries when binding to a port before giving up. | ||
|
Contributor
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. Not "Default" anymore |
||
| */ | ||
| val portMaxRetries: Int = { | ||
| lazy val portMaxRetries: Int = { | ||
|
Contributor
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. Why is this lazy?
Contributor
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. We should initialize this val until it is used but not from the beginning of initialization of Utils class. Defining
Contributor
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. If we just switch this to a
Contributor
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. Swithing to |
||
| if (sys.props.contains("spark.testing")) { | ||
| // Set a higher number of retries for tests... | ||
| sys.props.get("spark.port.maxRetries").map(_.toInt).getOrElse(100) | ||
|
Contributor
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. now that this takes in a conf, is it possible to replace these |
||
| } else { | ||
| Option(SparkEnv.get) | ||
| .flatMap(_.conf.getOption("spark.port.maxRetries")) | ||
| .map(_.toInt) | ||
| .getOrElse(16) | ||
| sys.props.get("spark.port.maxRetries").map(_.toInt).getOrElse(16) | ||
|
Contributor
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. I'm worried that changing this to read from System properties rather than the SparkEnv will break standalone mode here. Have you confirmed that In general we should prefer using SparkEnv over System properties because they have all kind of gotchas. There's a reason we created SparkEnv in the first place.
Contributor
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. yes, we should read from the conf, not from |
||
| } | ||
| } | ||
|
|
||
|
|
@@ -1719,6 +1716,7 @@ private[spark] object Utils extends Logging { | |
| serviceName: String = "", | ||
| maxRetries: Int = portMaxRetries): (T, Int) = { | ||
| val serviceString = if (serviceName.isEmpty) "" else s" '$serviceName'" | ||
| logInfo(s"Starting service$serviceString on port $startPort with maximum $maxRetries retries. ") | ||
|
Contributor
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. Typo: need extra space in
Contributor
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.
Contributor
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. I think it's better to not log this. It'll get fairly noisy if there are many retries. |
||
| for (offset <- 0 to maxRetries) { | ||
| // Do not increment port if startPort is 0, which is treated as a special port | ||
| val tryPort = if (startPort == 0) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,7 +76,9 @@ trait ExecutorRunnableUtil extends Logging { | |
| // uses Akka to connect to the scheduler, the akka settings are needed as well as the | ||
| // authentication settings. | ||
| sparkConf.getAll. | ||
| filter { case (k, v) => k.startsWith("spark.auth") || k.startsWith("spark.akka") }. | ||
| filter { case (k, v) => | ||
| k.startsWith("spark.auth") || k.startsWith("spark.akka") || k.equals("spark.port.maxRetries") | ||
|
||
| }. | ||
| foreach { case (k, v) => javaOpts += YarnSparkHadoopUtil.escapeForShell(s"-D$k=$v") } | ||
|
|
||
| sparkConf.getAkkaConf. | ||
|
|
||
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.
Then you'll need to update the docs here to say something like: