pyspark.SparkContext.getOrCreate#
- classmethod SparkContext.getOrCreate(conf=None)[source]#
Get or instantiate a
SparkContext
and register it as a singleton object.New in version 1.4.0.
- Parameters
- conf
SparkConf
, optional SparkConf
that will be used for initialization of theSparkContext
.
- conf
- Returns
SparkContext
current
SparkContext
, or a new one if it wasn’t created before the function call.
Examples
>>> SparkContext.getOrCreate() <SparkContext ...>