在PySpark中设置YARN队列

Tim*_*Tim 3 hadoop hadoop-yarn apache-spark pyspark

在PySpark中创建Spark上下文时,我通常使用以下代码:

conf = (SparkConf().setMaster("yarn-client").setAppName(appname)
        .set("spark.executor.memory", "10g")
        .set("spark.executor.instances", "7")
        .set("spark.driver.memory", "5g")
        .set("spark.shuffle.service.enabled","true")
        .set("spark.dynamicAllocation.enabled","true")
        .set("spark.dynamicAllocation.minExecutors","5")
        )
sc = SparkContext(conf=conf)
Run Code Online (Sandbox Code Playgroud)

但是,这会将其放入默认队列,该队列几乎总是超出容量。我们有几个较不繁忙的队列可用,所以我的问题是-如何将我的Spark上下文设置为使用另一个队列?

编辑:澄清一下-我正在为交互式作业设置队列(例如,在Jupyter笔记本中进行探索性分析),因此我无法设置带有火花提交的队列。

Man*_*pta 6

您可以在spark-submit命令中使用以下参数。

--queue queue_name
Run Code Online (Sandbox Code Playgroud)

您可以在代码中设置此属性。 spark.yarn.queue

希望这会有所帮助。

谢谢