在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)
但是,这会将其置于默认队列中,该队列几乎总是超出容量。我们有几个不太繁忙的队列,所以我的问题是 - 如何设置我的Spark上下文以使用另一个队列?
编辑:澄清 - 我希望为交互式作业设置队列(例如,在Jupyter笔记本中进行探索性分析),因此我无法使用spark-submit设置队列。
答案 0 :(得分:5)
您可以在spark-submit命令中使用以下参数。
--queue queue_name
您可以在代码中设置此属性。 spark.yarn.queue
希望这会有所帮助。
由于
答案 1 :(得分:0)
尝试使用" yarn.spark.queue"而不是"队列"。
conf = pyspark.SparkConf().set("yarn,spark.queue", "your_queue_name")
sc