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

HyukjinKwon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark-connect-rust.git


The following commit(s) were added to refs/heads/master by this push:
     new c8d274fb [SPARK-61359][CONNECT][INFRA] Read the crate directory when 
the proto build script runs, and pin the hash seed and the UDTF file timeout of 
the parity scripts
c8d274fb is described below

commit c8d274fbcd5a05ea93afe2aa94284cc78c3ddd05
Author: Hyukjin Kwon <[email protected]>
AuthorDate: Wed Nov 11 06:49:23 2026 +0900

    [SPARK-61359][CONNECT][INFRA] Read the crate directory when the proto build 
script runs, and pin the hash seed and the UDTF file timeout of the parity 
scripts
    
    ### What changes were proposed in this pull request?
    
    [SPARK-61359](https://issues.apache.org/jira/browse/SPARK-61359): three 
small build and test-infrastructure fixes from a review.
    
    - `crates/spark-connect-proto/build.rs` reads `CARGO_MANIFEST_DIR` when it 
runs, instead of `env!("CARGO_MANIFEST_DIR")`, which is baked in when the 
script is compiled. Cargo sets the variable for every build-script run.
    - `scripts/gen_parity_skiplist.py` pins `PYTHONHASHSEED=0` for its 
reference runs, as `scripts/run_official_tests.py` (and Apache's `bin/pyspark`) 
does.
    - `scripts/run_official_tests.py` gives `test_parity_udtf.py` the 1200 s 
cap of `test_parity_arrow_python_udf.py`.
    
    ### Why are the changes needed?
    
    - A build directory shared by several checkouts (git worktrees) can run a 
build script compiled in another checkout. Once that checkout is deleted, the 
build fails:
      ```
      protoc failed: Could not make proto path relative: <deleted 
checkout>/crates/spark-connect-proto/proto/spark/connect/base.proto: No such 
file or directory
      ```
    - With a random hash seed, about 7% of the runs of the official 
`test_crossvalidator_with_random_forest_classifier` train a fold on one label 
and fail, for the reference client too. So a regenerated skip manifest could 
pick up that flake.
    - `test_parity_udtf.py` runs 387 tests, most with a Python worker on the 
server. It takes 145-204 s on CI runners, but 466 s on a loaded machine, 
against the 360 s default cap.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No. Build and test infrastructure only.
    
    ### How was this patch tested?
    
    - `build.rs`: two checkouts at master shared one build directory. The first 
built the proto crate and was deleted, and then the second built it, with the 
build script of the first:
      - without the change, the second build failed with the error above;
      - with it, the second build passed.
    - `ruff check` and `ruff format --check` on the two scripts, and `cargo fmt 
--all --check`.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Opus 5.5
    
    This pull request and its description were written by Isaac.
    
    Closes #468 from HyukjinKwon/p3-infra.
    
    Authored-by: Hyukjin Kwon <[email protected]>
    Signed-off-by: Hyukjin Kwon <[email protected]>
---
 crates/spark-connect-proto/build.rs | 6 +++++-
 scripts/gen_parity_skiplist.py      | 4 ++++
 scripts/run_official_tests.py       | 3 +++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/crates/spark-connect-proto/build.rs 
b/crates/spark-connect-proto/build.rs
index c6b4436b..86a41a43 100644
--- a/crates/spark-connect-proto/build.rs
+++ b/crates/spark-connect-proto/build.rs
@@ -1,7 +1,11 @@
 use std::path::PathBuf;
 
 fn main() -> Result<(), Box<dyn std::error::Error>> {
-    let proto_root = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("proto");
+    // Read when the script runs, not baked in when it is compiled: a build 
dir shared by
+    // several checkouts can run a script compiled in another one, which may 
be gone.
+    let manifest_dir =
+        std::env::var_os("CARGO_MANIFEST_DIR").ok_or("CARGO_MANIFEST_DIR is 
not set")?;
+    let proto_root = PathBuf::from(manifest_dir).join("proto");
     let connect_dir = proto_root.join("spark").join("connect");
 
     // The vendored Spark Connect .proto files. Keep in sync with 
proto/PROTO_VERSION.txt.
diff --git a/scripts/gen_parity_skiplist.py b/scripts/gen_parity_skiplist.py
index 39aef2de..50cf9a71 100755
--- a/scripts/gen_parity_skiplist.py
+++ b/scripts/gen_parity_skiplist.py
@@ -57,6 +57,10 @@ def reference_failures(test_file: Path, spark_py: Path, 
remote: str, timeout: in
     so the manifest is independent of where the Spark source tree lives.
     """
     env = dict(os.environ)
+    # The fixed hash seed of run_official_tests.py (and of Apache's 
bin/pyspark): with a random
+    # one, about 7% of the runs of the official 
test_crossvalidator_with_random_forest_classifier
+    # train a fold on one label and fail, which would put a flake in the 
manifest.
+    env["PYTHONHASHSEED"] = "0"
     env["SPARK_CONNECT_TESTING_REMOTE"] = remote
     env["SPARK_TESTING"] = "1"
     env["SPARK_SKIP_CONNECT_COMPAT_TESTS"] = "1"
diff --git a/scripts/run_official_tests.py b/scripts/run_official_tests.py
index fa68f75f..925ef378 100755
--- a/scripts/run_official_tests.py
+++ b/scripts/run_official_tests.py
@@ -103,6 +103,9 @@ FLAKY_FILES = {
 # earlier whole-file TIMEOUT (p=0) was this file exceeding the 360s default, 
not a hang.
 SLOW_FILE_TIMEOUTS = {
     "test_parity_arrow_python_udf.py": 1200,
+    # 387 tests, most with a Python worker on the server: 145-204 s on CI 
runners, 466 s on a
+    # loaded machine, so the 360 s default leaves little margin.
+    "test_parity_udtf.py": 1200,
 }
 
 _FAIL_RE = re.compile(r"^(?:FAILED|ERROR)\s+(\S+)")


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

Reply via email to