Spark:如何在spark-submit中设置spark.yarn.executor.memoryOverhead属性

时间:2018-08-01 13:45:11

标签: apache-spark spark-submit

在Spark 2.0中。在运行spark提交时,如何设置spark.yarn.executor.memoryOverhead。

我知道,对于spark.executor.cores之类的东西,您可以设置--executor-cores 2。该属性是否具有相同的模式?例如--yarn-executor-memoryOverhead 4096

2 个答案:

答案 0 :(得分:5)

请查找示例。 这些值也可以在Sparkconf中给出。

示例:

./bin/spark-submit \
--[your class] \
--master yarn \
--deploy-mode cluster \
--num-exectors 17
--conf spark.yarn.executor.memoryOverhead=4096 \
--executor-memory 35G \  //Amount of memory to use per executor process 
--conf spark.yarn.driver.memoryOverhead=4096 \
--driver-memory 35G \   //Amount of memory to be used for the driver process
--executor-cores 5
--driver-cores 5 \     //number of cores to use for the driver process 
--conf spark.default.parallelism=170
 /path/to/examples.jar

答案 1 :(得分:0)

spark.yarn.executor.memoryOverhead已被弃用:

WARN spark.SparkConf: The configuration key 'spark.yarn.executor.memoryOverhead' has been deprecated as of Spark 2.3 and may be removed in the future. Please use the new key 'spark.executor.memoryOverhead' instead.

您可以通过编程将spark.executor.memoryOverhead设置为配置:

spark = (
    SparkSession.builder
        .master('yarn')
        .appName('StackOverflow')
        .config('spark.driver.memory', '35g')
        .config('spark.executor.cores', 5)
        .config('spark.executor.memory', '35g')
        .config('spark.dynamicAllocation.enabled', True)
        .config('spark.dynamicAllocation.maxExecutors', 25)
        .config('spark.yarn.executor.memoryOverhead', '4096')
        .getOrCreate()
)
sc = spark.sparkContext