You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "HyukjinKwon (via GitHub)" <gi...@apache.org> on 2025/03/04 08:02:36 UTC

[PR] [SPARK-51383][PYTHON][CONNECT] Avoid making RPC calls if clients are already known as stopped [spark]

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

   ### What changes were proposed in this pull request?
   
   This PR is sort of a followup of https://github.com/apache/spark/pull/40536 that fails fast if clients are already known as stopped.
   
   ### Why are the changes needed?
   
   To avoid overhead of making RPC calls when the clients are closed. Failing fast.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Internal changes.
   
   ### How was this patch tested?
   
   Existing tests added in https://github.com/apache/spark/pull/40536
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No.
   


-- 
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-unsubscribe@spark.apache.org

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


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


Re: [PR] [SPARK-51383][PYTHON][CONNECT] Avoid making RPC calls if clients are already known as stopped [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #50145:
URL: https://github.com/apache/spark/pull/50145#discussion_r1979635796


##########
python/pyspark/sql/connect/client/core.py:
##########
@@ -688,6 +690,19 @@ def __init__(
         # cleanup ml cache if possible
         atexit.register(self._cleanup_ml)
 
+    @staticmethod
+    def _check_if_closed(func: Callable) -> Callable:
+        @functools.wraps(func)
+        def wrapped(self: SparkConnectClient, *args: Any, **kwargs: Any) -> Any:

Review Comment:
   ```
     File "/__w/spark/spark/python/pyspark/sql/connect/client/core.py", line 696, in _check_if_closed
       def wrapped(self: SparkConnectClient, *args: Any, **kwargs: Any) -> Any:
                         ^^^^^^^^^^^^^^^^^^
   NameError: name 'SparkConnectClient' is not defined. Did you mean: 'SparkConnectException'?
   ```



-- 
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-unsubscribe@spark.apache.org

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


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


Re: [PR] [SPARK-51383][PYTHON][CONNECT] Avoid making RPC calls if clients are already known as stopped [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on PR #50145:
URL: https://github.com/apache/spark/pull/50145#issuecomment-2699478854

   Merged to master and branch-4.0.


-- 
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-unsubscribe@spark.apache.org

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


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


Re: [PR] [SPARK-51383][PYTHON][CONNECT] Avoid making RPC calls if clients are already known as stopped [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #50145:
URL: https://github.com/apache/spark/pull/50145#discussion_r1980395187


##########
python/pyspark/sql/connect/client/core.py:
##########
@@ -688,6 +690,19 @@ def __init__(
         # cleanup ml cache if possible
         atexit.register(self._cleanup_ml)
 
+    @staticmethod
+    def _check_if_closed(func: Callable) -> Callable:
+        @functools.wraps(func)
+        def wrapped(self: SparkConnectClient, *args: Any, **kwargs: Any) -> Any:

Review Comment:
   ```suggestion
           def wrapped(self: "SparkConnectClient", *args: Any, **kwargs: Any) -> Any:
   ```



-- 
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-unsubscribe@spark.apache.org

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


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


Re: [PR] [SPARK-51383][PYTHON][CONNECT] Avoid making RPC calls if clients are already known as stopped [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #50145:
URL: https://github.com/apache/spark/pull/50145#discussion_r1980395187


##########
python/pyspark/sql/connect/client/core.py:
##########
@@ -688,6 +690,19 @@ def __init__(
         # cleanup ml cache if possible
         atexit.register(self._cleanup_ml)
 
+    @staticmethod
+    def _check_if_closed(func: Callable) -> Callable:
+        @functools.wraps(func)
+        def wrapped(self: SparkConnectClient, *args: Any, **kwargs: Any) -> Any:

Review Comment:
   ```suggestion
           def wrapped(self: "SparkConnectClient", *args: Any, **kwargs: Any) -> Any:
   ```



-- 
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-unsubscribe@spark.apache.org

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


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


Re: [PR] [SPARK-51383][PYTHON][CONNECT] Avoid making RPC calls if clients are already known as stopped [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon closed pull request #50145: [SPARK-51383][PYTHON][CONNECT] Avoid making RPC calls if clients are already known as stopped
URL: https://github.com/apache/spark/pull/50145


-- 
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-unsubscribe@spark.apache.org

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


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


Re: [PR] [SPARK-51383][PYTHON][CONNECT] Avoid making RPC calls if clients are already known as stopped [spark]

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on PR #50145:
URL: https://github.com/apache/spark/pull/50145#issuecomment-2699285461

   Actually I have a better approach. Let me push some more changes


-- 
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-unsubscribe@spark.apache.org

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


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