I'm trying to get the path to spark.worker.dir
for the current sparkcontext
.
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
?
For a complete overview of your Spark environment and configuration I found the following code snippets useful:
SparkContext:
Hadoop Configuration:
Environment variables:
Spark 1.6+
Spark 2.1+
spark.sparkContext.getConf().getAll()
wherespark
is yoursparksession
(gives you adict
with all configured settings)For Spark 2+ you can also use when using scala
Yes: sc._conf.getAll()
Which uses the method:
as accessed by
Note the Underscore: that makes this tricky. I had to look at the spark source code to figure it out ;)
But it does work:
Just for the records the analogous java version: