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