Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4603#discussion_r24712317
  
    --- Diff: python/pyspark/java_gateway.py ---
    @@ -41,36 +43,33 @@ def launch_gateway():
             submit_args = submit_args if submit_args is not None else ""
             submit_args = shlex.split(submit_args)
             command = [os.path.join(SPARK_HOME, script)] + submit_args + 
["pyspark-shell"]
    +
    +        # Start a socket that will be used by PythonGatewayServer to 
communicate its port to us
    +        callback_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    +        callback_socket.bind(('127.0.0.1', 0))
    +        callback_socket.listen(1)
    +        callback_host, callback_port = callback_socket.getsockname()
    +        env = dict(os.environ)
    +        env['PYSPARK_DRIVER_CALLBACK_HOST'] = callback_host
    --- End diff --
    
    Admittedly, the introduction of new internal environment variables isn't 
great, but this let me avoid some pain in figuring out how to pipe a hostname / 
port pair from the Python driver through `spark-submit` all the way to the 
`PythonGatewayServer`.  If there's a strong feeling that we shouldn't do this, 
I don't mind figuring out how to implement SparkSubmit-argument-based plumbing 
instead, but I decided to not do that for the initial cut at fixing this issue.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to