Github user witgo commented on a diff in the pull request:
https://github.com/apache/spark/pull/2379#discussion_r17744702
--- Diff:
core/src/main/scala/org/apache/spark/deploy/worker/WorkerArguments.scala ---
@@ -47,14 +48,25 @@ private[spark] class WorkerArguments(args:
Array[String], conf: SparkConf) {
if (System.getenv("SPARK_WORKER_WEBUI_PORT") != null) {
webUiPort = System.getenv("SPARK_WORKER_WEBUI_PORT").toInt
}
- if (conf.contains("spark.worker.ui.port")) {
- webUiPort = conf.get("spark.worker.ui.port").toInt
- }
if (System.getenv("SPARK_WORKER_DIR") != null) {
workDir = System.getenv("SPARK_WORKER_DIR")
}
parse(args.toList)
+ propertiesFile =
Option(propertiesFile).getOrElse(Utils.getDefaultConfigFile)
+
+ Option(propertiesFile).foreach { file =>
+ Utils.getPropertiesFromFile(file).filter { case (k, v) =>
+ k.startsWith("spark.")
+ }.foreach { case (k, v) =>
+ conf.setIfMissing(k, v)
+ sys.props.getOrElseUpdate(k, v)
+ }
+ }
--- End diff --
I don't want to put too many things in a Utils's method. The method should
be kept simple.
How about this?
```scala
def loadSparkProperties(properties: Map[String, String],
conf: SparkConf): Unit = {
properties.filter { case (k, v) =>
k.startsWith("spark.")
}.foreach { case (k, v) =>
conf.setIfMissing(k, v)
sys.props.getOrElseUpdate(k, v)
}
}
```
---
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]