Class

org.apache.spark

SparkConf

Related Doc: package spark

Permalink

class SparkConf extends Cloneable with Logging

Configuration for a Spark application. Used to set various Spark parameters as key-value pairs.

Most of the time, you would create a SparkConf object with new SparkConf(), which will load values from any spark.* Java system properties set in your application as well. In this case, parameters you set directly on the SparkConf object take priority over system properties.

For unit tests, you can also call new SparkConf(false) to skip loading external settings and get the same configuration no matter what the system properties are.

All setter methods in this class support chaining. For example, you can write new SparkConf().setMaster("local").setAppName("My app").

Note that once a SparkConf object is passed to Spark, it is cloned and can no longer be modified by the user. Spark does not support modifying the configuration at runtime.

Source
SparkConf.scala
Linear Supertypes
Logging, Cloneable, Cloneable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SparkConf
  2. Logging
  3. Cloneable
  4. Cloneable
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SparkConf()

    Permalink

    Create a SparkConf that loads defaults from system properties and the classpath

  2. new SparkConf(loadDefaults: Boolean)

    Permalink

    loadDefaults

    whether to also load values from Java system properties

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): SparkConf

    Permalink

    Copy this object

    Copy this object

    Definition Classes
    SparkConf → AnyRef
  6. def contains(key: String): Boolean

    Permalink

    Does the configuration contain a given parameter?

  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. def get(key: String, defaultValue: String): String

    Permalink

    Get a parameter, falling back to a default if not set

  11. def get(key: String): String

    Permalink

    Get a parameter; throws a NoSuchElementException if it's not set

  12. def getAll: Array[(String, String)]

    Permalink

    Get all parameters as a list of pairs

  13. def getAppId: String

    Permalink

    Returns the Spark application id, valid in the Driver after TaskScheduler registration and from the start in the Executor.

  14. def getAvroSchema: Map[Long, String]

    Permalink

    Gets all the avro schemas in the configuration used in the generic Avro record serializer

  15. def getBoolean(key: String, defaultValue: Boolean): Boolean

    Permalink

    Get a parameter as a boolean, falling back to a default if not set

  16. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  17. def getDouble(key: String, defaultValue: Double): Double

    Permalink

    Get a parameter as a double, falling back to a default if not set

  18. def getExecutorEnv: Seq[(String, String)]

    Permalink

    Get all executor environment variables set on this SparkConf

  19. def getInt(key: String, defaultValue: Int): Int

    Permalink

    Get a parameter as an integer, falling back to a default if not set

  20. def getLong(key: String, defaultValue: Long): Long

    Permalink

    Get a parameter as a long, falling back to a default if not set

  21. def getOption(key: String): Option[String]

    Permalink

    Get a parameter as an Option

  22. def getSizeAsBytes(key: String, defaultValue: Long): Long

    Permalink

    Get a size parameter as bytes, falling back to a default if not set.

  23. def getSizeAsBytes(key: String, defaultValue: String): Long

    Permalink

    Get a size parameter as bytes, falling back to a default if not set.

    Get a size parameter as bytes, falling back to a default if not set. If no suffix is provided then bytes are assumed.

  24. def getSizeAsBytes(key: String): Long

    Permalink

    Get a size parameter as bytes; throws a NoSuchElementException if it's not set.

    Get a size parameter as bytes; throws a NoSuchElementException if it's not set. If no suffix is provided then bytes are assumed.

    Exceptions thrown
  25. def getSizeAsGb(key: String, defaultValue: String): Long

    Permalink

    Get a size parameter as Gibibytes, falling back to a default if not set.

    Get a size parameter as Gibibytes, falling back to a default if not set. If no suffix is provided then Gibibytes are assumed.

  26. def getSizeAsGb(key: String): Long

    Permalink

    Get a size parameter as Gibibytes; throws a NoSuchElementException if it's not set.

    Get a size parameter as Gibibytes; throws a NoSuchElementException if it's not set. If no suffix is provided then Gibibytes are assumed.

    Exceptions thrown
  27. def getSizeAsKb(key: String, defaultValue: String): Long

    Permalink

    Get a size parameter as Kibibytes, falling back to a default if not set.

    Get a size parameter as Kibibytes, falling back to a default if not set. If no suffix is provided then Kibibytes are assumed.

  28. def getSizeAsKb(key: String): Long

    Permalink

    Get a size parameter as Kibibytes; throws a NoSuchElementException if it's not set.

    Get a size parameter as Kibibytes; throws a NoSuchElementException if it's not set. If no suffix is provided then Kibibytes are assumed.

    Exceptions thrown
  29. def getSizeAsMb(key: String, defaultValue: String): Long

    Permalink

    Get a size parameter as Mebibytes, falling back to a default if not set.

    Get a size parameter as Mebibytes, falling back to a default if not set. If no suffix is provided then Mebibytes are assumed.

  30. def getSizeAsMb(key: String): Long

    Permalink

    Get a size parameter as Mebibytes; throws a NoSuchElementException if it's not set.

    Get a size parameter as Mebibytes; throws a NoSuchElementException if it's not set. If no suffix is provided then Mebibytes are assumed.

    Exceptions thrown
  31. def getTimeAsMs(key: String, defaultValue: String): Long

    Permalink

    Get a time parameter as milliseconds, falling back to a default if not set.

    Get a time parameter as milliseconds, falling back to a default if not set. If no suffix is provided then milliseconds are assumed.

  32. def getTimeAsMs(key: String): Long

    Permalink

    Get a time parameter as milliseconds; throws a NoSuchElementException if it's not set.

    Get a time parameter as milliseconds; throws a NoSuchElementException if it's not set. If no suffix is provided then milliseconds are assumed.

    Exceptions thrown
  33. def getTimeAsSeconds(key: String, defaultValue: String): Long

    Permalink

    Get a time parameter as seconds, falling back to a default if not set.

    Get a time parameter as seconds, falling back to a default if not set. If no suffix is provided then seconds are assumed.

  34. def getTimeAsSeconds(key: String): Long

    Permalink

    Get a time parameter as seconds; throws a NoSuchElementException if it's not set.

    Get a time parameter as seconds; throws a NoSuchElementException if it's not set. If no suffix is provided then seconds are assumed.

    Exceptions thrown
  35. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  36. def initializeLogIfNecessary(isInterpreter: Boolean): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  37. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  38. def isTraceEnabled(): Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  39. def log: Logger

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  40. def logDebug(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  41. def logDebug(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  42. def logError(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  43. def logError(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  44. def logInfo(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  45. def logInfo(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  46. def logName: String

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  47. def logTrace(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  48. def logTrace(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  49. def logWarning(msg: ⇒ String, throwable: Throwable): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  50. def logWarning(msg: ⇒ String): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  51. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  52. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  53. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  54. def registerAvroSchemas(schemas: Schema*): SparkConf

    Permalink

    Use Kryo serialization and register the given set of Avro schemas so that the generic record serializer can decrease network IO

  55. def registerKryoClasses(classes: Array[Class[_]]): SparkConf

    Permalink

    Use Kryo serialization and register the given set of classes with Kryo.

    Use Kryo serialization and register the given set of classes with Kryo. If called multiple times, this will append the classes from all calls together.

  56. def remove(key: String): SparkConf

    Permalink

    Remove a parameter from the configuration

  57. def set(key: String, value: String): SparkConf

    Permalink

    Set a configuration variable.

  58. def setAll(settings: Traversable[(String, String)]): SparkConf

    Permalink

    Set multiple parameters together

  59. def setAppName(name: String): SparkConf

    Permalink

    Set a name for your application.

    Set a name for your application. Shown in the Spark web UI.

  60. def setExecutorEnv(variables: Array[(String, String)]): SparkConf

    Permalink

    Set multiple environment variables to be used when launching executors.

    Set multiple environment variables to be used when launching executors. (Java-friendly version.)

  61. def setExecutorEnv(variables: Seq[(String, String)]): SparkConf

    Permalink

    Set multiple environment variables to be used when launching executors.

    Set multiple environment variables to be used when launching executors. These variables are stored as properties of the form spark.executorEnv.VAR_NAME (for example spark.executorEnv.PATH) but this method makes them easier to set.

  62. def setExecutorEnv(variable: String, value: String): SparkConf

    Permalink

    Set an environment variable to be used when launching executors for this application.

    Set an environment variable to be used when launching executors for this application. These variables are stored as properties of the form spark.executorEnv.VAR_NAME (for example spark.executorEnv.PATH) but this method makes them easier to set.

  63. def setIfMissing(key: String, value: String): SparkConf

    Permalink

    Set a parameter if it isn't already configured

  64. def setJars(jars: Array[String]): SparkConf

    Permalink

    Set JAR files to distribute to the cluster.

    Set JAR files to distribute to the cluster. (Java-friendly version.)

  65. def setJars(jars: Seq[String]): SparkConf

    Permalink

    Set JAR files to distribute to the cluster.

  66. def setMaster(master: String): SparkConf

    Permalink

    The master URL to connect to, such as "local" to run locally with one thread, "local[4]" to run locally with 4 cores, or "spark://master:7077" to run on a Spark standalone cluster.

  67. def setSparkHome(home: String): SparkConf

    Permalink

    Set the location where Spark is installed on worker nodes.

  68. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  69. def toDebugString: String

    Permalink

    Return a string listing all keys and values, one per line.

    Return a string listing all keys and values, one per line. This is useful to print the configuration out for debugging.

  70. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  71. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  72. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  73. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Logging

Inherited from Cloneable

Inherited from Cloneable

Inherited from AnyRef

Inherited from Any

Ungrouped