Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2516#discussion_r18003337
  
    --- Diff: 
core/src/main/scala/org/apache/spark/deploy/SparkSubmitArguments.scala ---
    @@ -406,22 +413,166 @@ private[spark] class SparkSubmitArguments(args: 
Seq[String]) {
       }
     }
     
    +
     object SparkSubmitArguments {
    -  /** Load properties present in the given file. */
    -  def getPropertiesFromFile(file: File): Seq[(String, String)] = {
    -    require(file.exists(), s"Properties file $file does not exist")
    -    require(file.isFile(), s"Properties file $file is not a normal file")
    -    val inputStream = new FileInputStream(file)
    -    try {
    -      val properties = new Properties()
    -      properties.load(inputStream)
    -      properties.stringPropertyNames().toSeq.map(k => (k, 
properties(k).trim))
    -    } catch {
    -      case e: IOException =>
    -        val message = s"Failed when loading Spark properties file $file"
    -        throw new SparkException(message, e)
    -    } finally {
    -      inputStream.close()
    +  /**
    +   * Resolves Configuration sources in order of highest to lowest
    +   * 1. Each map passed in as additionalConfig from first to last
    +   * 2. Environment variables (including legacy variable mappings)
    +   * 3. System config variables (eg by using -Dspark.var.name)
    +   * 4  SPARK_DEFAULT_CONF/spark-defaults.conf or 
SPARK_HOME/conf/spark-defaults.conf
    +   * 5. hard coded defaults in class path at spark-submit-defaults.prop
    +   *
    +   * A property file specified by one of the means listed above gets read 
in and the properties are
    +   * considered to be at the priority of the method that specified the 
files.
    +   * A property specified in a property file will not override an existing
    +   * config value at that same level
    +   *
    +   * @param additionalConfigs additional Map[ConfigName->ConfigValue] in 
order of highest
    +   *                          priority to lowest
    +   * @return Map[propName->propFile] containing values merged from all 
sources in order of priority
    +   */
    +  def mergeSparkProperties(additionalConfigs: Vector[Map[String,String]]) 
= {
    +
    +    // Configuration read in from spark-submit-defaults.prop file found on 
the classpath
    +    val is = Option(Thread.currentThread().getContextClassLoader()
    +      .getResourceAsStream(SparkSubmitDefaults))
    +
    +    val hardCodedDefaultConfig = is.flatMap{x =>
    --- End diff --
    
    Space after `{`.  Also, you can just use plain `map`.


---
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]

Reply via email to