Skip to content

Commit 1a371d9

Browse files
committed
Addressed comments.
1 parent 60479da commit 1a371d9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

python/pyspark/streaming/context.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,12 @@ def getActive(cls):
185185
# backing the supposedly active Python context
186186
activePythonContextJavaId = activePythonContext._jssc.ssc().hashCode()
187187
activeJvmContextOption = activePythonContext._jvm.StreamingContext.getActive()
188-
if activeJvmContextOption.isEmpty() or \
189-
activeJvmContextOption.get().hashCode() != activePythonContextJavaId:
188+
189+
if activeJvmContextOption.isEmpty():
190190
cls._activeContext = None
191+
elif activeJvmContextOption.get().hashCode() != activePythonContextJavaId:
192+
raise Exception("JVM's active JavaStreamingContext is not the JavaStreamingContext "
193+
"backing the action Python StreamingContext. This is unexpected.")
191194
return cls._activeContext
192195

193196
@classmethod

0 commit comments

Comments
 (0)