是否可以在PySpark中获取当前的Spark上下文设置? [英] Is it possible to get the current spark context settings in PySpark?
本文介绍了是否可以在PySpark中获取当前的Spark上下文设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试获取当前sparkcontext
的spark.worker.dir
路径.
I'm trying to get the path to spark.worker.dir
for the current sparkcontext
.
如果我将其明确设置为config param
,则可以从SparkConf
中读回它,但是仍然可以使用PySpark
访问完整的config
(包括所有默认值)吗?
If I explicitly set it as a config param
, I can read it back out of SparkConf
, but is there anyway to access the complete config
(including all defaults) using PySpark
?
推荐答案
Spark 2.1 +
Spark 2.1+
spark.sparkContext.getConf().getAll()
,其中spark
是您的sparksession
(为您提供所有配置设置的dict
)
spark.sparkContext.getConf().getAll()
where spark
is your sparksession
(gives you a dict
with all configured settings)
这篇关于是否可以在PySpark中获取当前的Spark上下文设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文