This is an automated email from the ASF dual-hosted git repository.

ruifengz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 18402fd11e67 [SPARK-54572][PYTHON][FOLLOWUP] Rule out some process and 
add a warning for zip file
18402fd11e67 is described below

commit 18402fd11e6789bfb5fb09bd1f91622ed4021bb8
Author: Tian Gao <[email protected]>
AuthorDate: Tue Dec 9 14:05:35 2025 +0800

    [SPARK-54572][PYTHON][FOLLOWUP] Rule out some process and add a warning for 
zip file
    
    ### What changes were proposed in this pull request?
    
    Use `sys.orig_argv` to rule out the non-user debugpy process.
    
    Add a warning message if `pyspark.zip` exists - because the user won't be 
able to hit the breakpoint inside the worker.
    
    ### Why are the changes needed?
    
    Improve the user experience with VSCode debugging.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Locally confirmed that the warning is issued.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No
    
    Closes #53398 from gaogaotiantian/issue-warning-for-vscode.
    
    Authored-by: Tian Gao <[email protected]>
    Signed-off-by: Ruifeng Zheng <[email protected]>
---
 python/conf_vscode/sitecustomize.py | 5 ++++-
 python/run-with-vscode-breakpoints  | 6 ++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/python/conf_vscode/sitecustomize.py 
b/python/conf_vscode/sitecustomize.py
index 3c3abe69c27b..a8bdda6c7db3 100644
--- a/python/conf_vscode/sitecustomize.py
+++ b/python/conf_vscode/sitecustomize.py
@@ -19,7 +19,10 @@ try:
     import os
     import sys
 
-    if "DEBUGPY_ADAPTER_ENDPOINTS" in os.environ and not any("debugpy" in arg 
for arg in sys.argv):
+    if (
+        "DEBUGPY_ADAPTER_ENDPOINTS" in os.environ and
+        not any("debugpy" in arg for arg in sys.orig_argv)
+    ):
 
         def install_debugpy():
             import debugpy
diff --git a/python/run-with-vscode-breakpoints 
b/python/run-with-vscode-breakpoints
index 11c821fa8323..7b86ae66a96b 100755
--- a/python/run-with-vscode-breakpoints
+++ b/python/run-with-vscode-breakpoints
@@ -44,6 +44,12 @@ if ! python3 -c "import debugpy" 2>/dev/null; then
   exit 1
 fi
 
+# If lib/pyspark.zip exists, issue a warning
+if [ -f "$FWDIR/lib/pyspark.zip" ]; then
+  echo "Warning: lib/pyspark.zip exists. VSCode debugger won't pick up your 
breakpoints in workers."
+  echo "You can remove it to avoid potential issues."
+fi
+
 # If --hook-daemon is in the arguments, set the env variable to hook the 
daemon process
 # Daemon is not hooked by default to avoid potential fork issues
 new_args=()


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

Reply via email to