wbo4958 opened a new pull request, #54106:
URL: https://github.com/apache/spark/pull/54106

   ### What changes were proposed in this pull request?
   
   This PR adds an _on_exit handler to SparkConnectClient that is registered 
with Python's atexit module. When enabled via the 
SPARK_CONNECT_RELEASE_SESSION_ON_EXIT environment variable, the client will 
automatically
   
   
   ### Why are the changes needed?
   
   Currently, when a PySpark Connect client process exits without explicitly 
calling `spark.stop()`, the session may remain active on the server side, 
consuming resources unnecessarily. This change provides an opt-in mechanism to 
automatically release the session during process exit
   
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Users can now set the environment variable 
`SPARK_CONNECT_RELEASE_SESSION_ON_EXIT=true` to enable automatic session 
release when the Python process exits.
   
   
   
   ### How was this patch tested?
   
   Pass the CIs.
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Yes, co-authored with claude-4.5-opus-high
   


-- 
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