Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/2516#discussion_r18001020
--- Diff:
core/src/main/scala/org/apache/spark/deploy/SparkSubmitArguments.scala ---
@@ -17,164 +17,205 @@
package org.apache.spark.deploy
-import java.io.{File, FileInputStream, IOException}
-import java.util.Properties
+import java.io.{InputStream, File, FileInputStream}
import java.util.jar.JarFile
-
+import java.util.Properties
+import java.util.{Map=>JavaMap}
import scala.collection.JavaConversions._
-import scala.collection.mutable.{ArrayBuffer, HashMap}
-import org.apache.spark.SparkException
+import org.apache.spark.deploy.ConfigConstants._
import org.apache.spark.util.Utils
+import scala.collection._
+import scala.collection.JavaConverters._
+import scala.collection.{mutable=>m}
+
/**
- * Parses and encapsulates arguments from the spark-submit script.
- */
+ * Pulls configuration information together in order of priority
+ *
+ * Entries in the conf Map will be filled in the following priority order
+ * 1. entries specified on the command line (except from --conf entries)
+ * 2. Entries specified on the command line with --conf
+ * 3. Environment variables (including legacy variable mappings)
+ * 4. System config variables (eg by using -Dspark.var.name)
+ * 5 SPARK_DEFAULT_CONF/spark-defaults.conf or
SPARK_HOME/conf/spark-defaults.conf if either exist
+ * 6. 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
+*/
private[spark] class SparkSubmitArguments(args: Seq[String]) {
- var master: String = null
- var deployMode: String = null
- var executorMemory: String = null
- var executorCores: String = null
- var totalExecutorCores: String = null
- var propertiesFile: String = null
- var driverMemory: String = null
- var driverExtraClassPath: String = null
- var driverExtraLibraryPath: String = null
- var driverExtraJavaOptions: String = null
- var driverCores: String = null
- var supervise: Boolean = false
- var queue: String = null
- var numExecutors: String = null
- var files: String = null
- var archives: String = null
- var mainClass: String = null
- var primaryResource: String = null
- var name: String = null
- var childArgs: ArrayBuffer[String] = new ArrayBuffer[String]()
- var jars: String = null
- var verbose: Boolean = false
- var isPython: Boolean = false
- var pyFiles: String = null
- val sparkProperties: HashMap[String, String] = new HashMap[String,
String]()
-
- /** Default properties present in the currently defined defaults file. */
- lazy val defaultSparkProperties: HashMap[String, String] = {
- val defaultProperties = new HashMap[String, String]()
- if (verbose) SparkSubmit.printStream.println(s"Using properties file:
$propertiesFile")
- Option(propertiesFile).foreach { filename =>
- val file = new File(filename)
- SparkSubmitArguments.getPropertiesFromFile(file).foreach { case (k,
v) =>
- if (k.startsWith("spark")) {
- defaultProperties(k) = v
- if (verbose) SparkSubmit.printStream.println(s"Adding default
property: $k=$v")
- } else {
- SparkSubmit.printWarning(s"Ignoring non-spark config property:
$k=$v")
- }
- }
- }
- defaultProperties
- }
+ /**
+ * Stores all configuration items except for child arguments,
+ * referenced by the constantsdefined in ConfigConstants.scala
+ */
+ val conf = new m.HashMap[String, String]()
+
+ def master = conf.get(SparkMaster).get
--- End diff --
a.k.a. `conf(SparkMaster)`
---
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]