Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/16975#discussion_r102337722
--- Diff: core/src/main/scala/org/apache/spark/SparkContext.scala ---
@@ -470,12 +470,25 @@ class SparkContext(config: SparkConf) extends Logging
{
files.foreach(addFile)
}
- _executorMemory = _conf.getOption("spark.executor.memory")
- .orElse(Option(System.getenv("SPARK_EXECUTOR_MEMORY")))
- .orElse(Option(System.getenv("SPARK_MEM"))
- .map(warnSparkMem))
- .map(Utils.memoryStringToMb)
- .getOrElse(1024)
+ _executorMemory = {
+ val defaultMemory = 1024
+ val configuredMemory = _conf.getOption("spark.executor.memory")
+ .orElse(Option(System.getenv("SPARK_EXECUTOR_MEMORY")))
+ .orElse(Option(System.getenv("SPARK_MEM")).map(warnSparkMem))
+ .map(Utils.memoryStringToMb)
+ // In local-cluster mode, always use the slave memory specified in
the master string
+ // In other modes, use the configured memory if it exists
+ master match {
+ case SparkMasterRegex.LOCAL_CLUSTER_REGEX(_, _, em) =>
+ if (configuredMemory.isDefined) {
--- End diff --
Could you at least change this so that `spark.executor.memory` takes
precedence if it's set? Then both use cases are possible. (Maybe someone is
crazy enough to be trying dynamic allocation in local-cluster mode, or
something else...)
---
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]