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