HyukjinKwon opened a new pull request #33147:
URL: https://github.com/apache/spark/pull/33147


   ### What changes were proposed in this pull request?
   
   Currently ,we sets the environment variable `PYSPARK_PIN_THREAD` at the 
client side of `InhertiableThread` API for Py4J (`python/pyspark/util.py`). If 
the Py4J gateway is created somewhere else (e.g., Zeppelin, etc), it could 
introduce a breakage at:
   
   ```python
   from pyspark import SparkContext
   jvm = SparkContext._jvm
   thread_connection = jvm._gateway_client.get_thread_connection()
   # `AttributeError: 'GatewayClient' object has no attribute 
'get_thread_connection'` (non-pinned thread mode)
   # `get_thread_connection` is only in 'ClientServer' (pinned thread mode)
   ```
   
   This PR proposes to check the given gateway created, and do the pinned 
thread mode behaviour accordingly so we can avoid any breakage when Py4J 
server/gateway is created separately from somewhere else without a pinned 
thread mode.
   
   ### Why are the changes needed?
   
   To avoid any potential breakage.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, the change happened only in the master 
(https://github.com/apache/spark/commit/fdd7ca5f4e35a906090f3c6b160bdba9ac9fd0ca).
   
   ### How was this patch tested?
   
   This is actually a partial revert of 
https://github.com/apache/spark/commit/fdd7ca5f4e35a906090f3c6b160bdba9ac9fd0ca.
 As long as the existing tests pass, I guess we're all good. It's difficult to 
test also.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to