susheel-aroskar commented on code in PR #53076: URL: https://github.com/apache/spark/pull/53076#discussion_r2666932999
########## python/pyspark/sql/tests/connect/client/test_client_call_stack_trace.py: ########## @@ -0,0 +1,487 @@ +# +# 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. +# + +import os +import unittest +from unittest.mock import patch + +import pyspark +from pyspark.testing.connectutils import should_test_connect, connect_requirement_message + +if should_test_connect: + import pyspark.sql.connect.proto as pb2 + from pyspark.sql.connect.client import SparkConnectClient, core + from pyspark.sql.connect.client.core import ( + _is_pyspark_source, + _retrieve_stack_frames, + _build_call_stack_trace, + ) + + # The _cleanup_ml_cache invocation will hang in this test (no valid spark cluster) + # and it blocks the test process exiting because it is registered as the atexit handler + # in `SparkConnectClient` constructor. To bypass the issue, patch the method in the test. + SparkConnectClient._cleanup_ml_cache = lambda _: None + +# SPARK-54314: Improve Server-Side debuggability in Spark Connect by capturing client application's +# file name and line numbers in PySpark +# https://issues.apache.org/jira/browse/SPARK-54314 + + [email protected](not should_test_connect, connect_requirement_message) +class CallStackTraceTestCase(unittest.TestCase): Review Comment: I ran it using `python -m unittest pyspark.sql.tests.connect.client.test_client_call_stack_trace` in `./python` directory and it passes all tests. Not sure if it needs E2E setup. -- 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]
