[spark-rapids] Add init script support for updating SPARK RAPIDS jar on Dataproc 2.3 ML - #1372
Conversation
Summary of ChangesHello @SurajAralihalli, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Spark RAPIDS initialization script to intelligently handle Dataproc 2.3 ML images. By introducing checks for existing Spark RAPIDS installations and providing mechanisms to update them, the script ensures that the correct RAPIDS version is deployed efficiently, avoiding unnecessary driver installations on environments where they are already present. This streamlines the setup process for Spark RAPIDS on Dataproc ML clusters. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
@cjac @jayadeep-jayaraman @codelixir for reviews |
There was a problem hiding this comment.
Code Review
This pull request refactors the Spark RAPIDS installation script to support Dataproc ML images, which come with Spark RAPIDS pre-installed. The approach of checking for an existing JAR and only updating it is sound. I've identified a high-severity issue where YARN services are not restarted after the JAR is updated on ML images, which would prevent the changes from taking effect. I've also included a medium-severity suggestion to improve the robustness of the script.
|
/gcbrun |
|
@codelixir can this PR be merged? |
|
sorry for the delay here. I've been caught up in other things. /gcbrun |
|
My first review of the change indicates to me that this change treats the -ml image type differently than non-ml images. This accelerates the delivery pipeline by removing much of the installation. These changes should be generatlized to detect component installation status independent of what the image type is so that using a custom image (#120) of any os image with the assets pre-installed as an alternative. |
|
@SurajAralihalli would you like me to implement the changes I recommended and patch your PR for your review? |
Sure @cjac! |
|
Okay, it's in progress. I will try to finish it this weekend, but I can't promise. we'll see how far I get. Right now it captures information about packages installed at the system and conda levels I am working on getting better diagnostics on Rocky, but it's not very well supported quite yet. I have the evaluation printing the information in all of different starting States including fresh base image, custom image with secure boot, custom image with secure Boot and GPU driver installer run to completion, and 2.3 ml I have yet to try anything before the 2.2 image |
Journal Entry: 2026-02-06 - PR #1372 AnalysisProject: Dataproc Initialization Actions - Spark RAPIDS Actions:
Outcome: Clear understanding of the task to refactor the spark-rapids init action to dynamically detect the environment. Journal Entry: 2026-02-07 - GPU Environment Detection Script DevelopmentProject: Dataproc Initialization Actions - Spark RAPIDS Actions:
Outcome: First version of GPU detection functions created. Identified need for refinement in Conda and CUDA checks. Journal Entry: 2026-02-07 - Refining Conda and CUDA DetectionProject: Dataproc Initialization Actions - Spark RAPIDS Actions:
Outcome: Conda package detection is more reliable and less verbose. CUDA version detection is more robust. Journal Entry: 2026-02-07 - Enhancing JAR and System Information DetectionProject: Dataproc Initialization Actions - Spark RAPIDS Actions:
Outcome: More comprehensive environment detection, including JAR versions, Secure Boot, and Proxy settings. Output is now a summary. Journal Entry: 2026-02-07 - Improving GPU Hardware DetectionProject: Dataproc Initialization Actions - Spark RAPIDS Actions:
Outcome: GPU hardware detection is now more robust by directly checking PCI devices. Journal Entry: 2026-02-08 - JSON Output GenerationProject: Dataproc Initialization Actions - Spark RAPIDS Actions:
Outcome: Journal Entry: 2026-02-08 - System Package Version DetectionProject: Dataproc Initialization Actions - Spark RAPIDS Actions:
Outcome: Journal Entry: 2026-02-08 - Script SplittingProject: Dataproc Initialization Actions - Spark RAPIDS Actions:
Outcome: The |
Plan for Integrating Environment Probe - File by FileGoal: Integrate the Method: All files in the target directory are concatenated in alphanumeric order to produce Milestones:
|
|
/gcbrun |
b56bb63 to
95a7510
Compare
|
/gcbrun |
95a7510 to
df0af13
Compare
|
/gcbrun |
d5f16e5 to
eb6f87d
Compare
|
/gcbrun |
13dc91f to
8309e03
Compare
|
/gcbrun |
4 similar comments
|
/gcbrun |
|
/gcbrun |
|
/gcbrun |
|
/gcbrun |
|
/gcbrun |
1 similar comment
|
/gcbrun |
8dc5e3e to
ee7646d
Compare
|
/gcbrun |
ee7646d to
ff1404b
Compare
|
/gcbrun |
ff1404b to
92b1e59
Compare
|
/gcbrun |
1 similar comment
|
/gcbrun |
92b1e59 to
00276a6
Compare
|
/gcbrun |
2 similar comments
|
/gcbrun |
|
/gcbrun |
00276a6 to
00efa17
Compare
|
/gcbrun |
1 similar comment
|
/gcbrun |
00efa17 to
7607216
Compare
|
/gcbrun |
7607216 to
83a6599
Compare
|
/gcbrun |
|
/gcbrun |
|
/gcbrun |
cjac
left a comment
There was a problem hiding this comment.
Code Review: PR #1372 - Spark RAPIDS Enhancements
Summary
This review covers the refactoring of the spark-rapids.sh initialization action. The changes generalize the script to work across Standard Dataproc Images, ML Images, and Custom Hardened Images, eliminating special-casing while adding auto-detection and version enforcement.
Key Improvements
1. 3-Phase Architecture (Audit / Plan / Execute)
The script uses a pipeline:
- Audit: Detects GPU hardware, driver status, CUDA presence, and installed JAR versions (using
compgenchecks) without assuming image types. - Plan: Decides what needs to be installed, upgraded, or reconfigured based on current state vs. goals.
- Execute: Runs required installation functions, avoiding redundant downloads or duplicate driver installations.
2. Dynamic Version Auto-Detection from Maven
- Queries Maven Central directly to fetch the latest stable releases of
rapids-4-sparkand companionxgboostpackages if not explicitly pinned in metadata. - Falls back to hardcoded default versions if the cluster is air-gapped or network calls fail.
3. Secure Boot & Custom Image Hardening
- Fixed compatibility for Secure Boot environments where drivers are pre-installed on a custom image but signing material is not provided at runtime.
- Added guards (
! command -v nvidia-smi) ensuring custom images (like-tfvariants) do not trigger unnecessary or failing driver reinstall attempts.
4. Purges on Replace
When version upgrades (or downgrades) are requested/detected, the script purges older rapids-4-spark_*.jar and companion xgboost driver files before installing new variants rather than downloading alongside them, avoiding potential Spark classpath conflicts.
5. XGBoost Auto-Targeting Fix
Handles upstream Maven divergences by binding the XGBoost auto-detector against the explicit companion artifact xgboost4j-gpu avoiding 404 errors when attempting newer versions on historical Scala runtimes (e.g. 2.12).
Verification
- Validated on Debian 11/12 standard, Dataproc ML variants.
- Validated upgrade path from pre-baked 25.08 JARs on custom ML templates to newer Maven defaults.
- All CI tests passed.
Verdict: Code path is ready and improves maintaining these init actions.
Dataproc ML images (
2.3-ml-ubuntu) come with NVIDIA drivers and Spark RAPIDS preinstalled by default, so the init script should only update the RAPIDS JAR and skip all other setup steps.This PR:
install_gpu_xgboostand added a new function to check for existing RAPIDS JARs.remove_spark_rapids_jarto clean up existing JARs before installation.mainfunction to ensure the correct RAPIDS version is installed, and skips NVIDIA driver installation when the instance already includes the Spark RAPIDS jar (applies to ML images).