Skip to content

Commit 5b23686

Browse files
committed
Updated context.py with method descriptions
Added descriptions for methods _initialize_context and _ensure_initialized
1 parent a18ea00 commit 5b23686

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

python/pyspark/context.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,18 @@ def __init__(self, master=None, appName=None, sparkHome=None, pyFiles=None,
162162
self._temp_dir = \
163163
self._jvm.org.apache.spark.util.Utils.createTempDir(local_dir).getAbsolutePath()
164164

165-
# Initialize SparkContext in function to allow subclass specific initialization
166165
def _initialize_context(self, jconf):
166+
"""
167+
Initialize SparkContext in function to allow subclass specific initialization
168+
"""
167169
return self._jvm.JavaSparkContext(jconf)
168170

169171
@classmethod
170172
def _ensure_initialized(cls, instance=None, gateway=None):
173+
"""
174+
Checks whether a SparkContext is initialized or not.
175+
Throws error if a SparkContext is already running.
176+
"""
171177
with SparkContext._lock:
172178
if not SparkContext._gateway:
173179
SparkContext._gateway = gateway or launch_gateway()

0 commit comments

Comments
 (0)