ericm-db commented on code in PR #56907:
URL: https://github.com/apache/spark/pull/56907#discussion_r3547830059


##########
python/pyspark/sql/connect/local_server.py:
##########
@@ -0,0 +1,212 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+"""
+Long-lived local Spark Connect server for the opt-in reuse path.
+
+This module is launched as a *detached* child process by
+``SparkSession._reuse_or_start_local_connect_server`` (in 
``pyspark.sql.connect.session``) when
+``SPARK_LOCAL_CONNECT_REUSE`` / ``spark.local.connect.reuse`` is enabled. It 
starts a regular
+(classic) local Spark session with the Spark Connect plugin -- the same 
mechanism the in-process
+``SparkSession._start_connect_server`` uses -- and then blocks, so one warm 
JVM and Spark Connect
+server keeps serving many short-lived client processes. Each client connection 
gets its own
+isolated server-side session, so session-local state (temp views, runtime SQL 
confs, isolated
+artifacts) does not leak between runs.
+
+Once the server is accepting connections it writes a discovery file (host, the 
actually bound port,
+the auth token, its pid and the Spark version) that later client processes 
read to reconnect.
+
+It is launched by file path rather than ``python -m`` so it does not require 
the Spark Connect

Review Comment:
   Agreed. Made the change



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to