From 0edbfa0a9040eb0166271db82866886dade928aa Mon Sep 17 00:00:00 2001 From: Ali Maredia Date: Wed, 18 Nov 2026 16:46:36 -0500 Subject: [PATCH] Replace EC2 GPU runners with GitHub-hosted CPU runners - Remove launch/stop EC2 runner jobs, AWS OIDC auth, and CUDA/NCCL setup from execute-all-notebooks.yml and execute-kfp-localrunners.yml; both workflows now run on ubuntu-latest with actions/setup-python - Drop Docker CE installation in pipeline tests (preinstalled on GH runners) and raise the per-pipeline timeout from 30 to 60 minutes for CPU conversion - Raise per-notebook papermill timeout from 600s to 1800s for CPU execution - Exclude document-conversion-vlm.ipynb from notebook test discovery since the local SmolDocling VLM is too slow without a GPU; run it by hand instead --- .github/workflows/execute-all-notebooks.yml | 143 +++--------------- .../workflows/execute-kfp-localrunners.yml | 121 +++------------ tests/conftest.py | 7 +- tests/test_notebook_execution.py | 4 +- 4 files changed, 47 insertions(+), 228 deletions(-) diff --git a/.github/workflows/execute-all-notebooks.yml b/.github/workflows/execute-all-notebooks.yml index 4b528140..472c283b 100644 --- a/.github/workflows/execute-all-notebooks.yml +++ b/.github/workflows/execute-all-notebooks.yml @@ -17,8 +17,6 @@ on: paths: - "notebooks/**/*.ipynb" - ".github/workflows/execute-all-notebooks.yml" -env: - INSTANCE_TYPE: "g6e.xlarge" # We don't need anything other than Bash for our shell.. defaults: @@ -26,51 +24,10 @@ defaults: shell: bash jobs: - launch-ec2-runner: + execute-all-notebooks: runs-on: ubuntu-latest permissions: - id-token: write # This is required for OIDC (AWS auth) contents: read - outputs: - label: ${{ steps.start-ec2-runner.outputs.label }} - ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5.1.1 - with: - role-to-assume: "arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ vars.DATA_PROCESSING_IAM_ROLE }}" - aws-region: us-east-2 - role-session-name: odh-data-processing # For tracking in CloudTrail - - - name: Start Data Processing EC2 runner - id: start-ec2-runner - uses: machulav/ec2-github-runner@343a1b2ae682e681c3cec9a235d882da17ff04ef # v2.6.1 - with: - mode: start - github-token: "${{ secrets.DATA_PROCESSING_GH_PERSONAL_ACCESS_TOKEN }}" - ec2-instance-type: "${{ env.INSTANCE_TYPE }}" - availability-zones-config: > - [ - {"imageId": "${{ vars.US_EAST_2_AMI_ID }}", "subnetId": "${{ vars.US_EAST_2A_SUBNET_ID }}", "securityGroupId": "${{ vars.US_EAST_2_SG_ID }}"}, - {"imageId": "${{ vars.US_EAST_2_AMI_ID }}", "subnetId": "${{ vars.US_EAST_2B_SUBNET_ID }}", "securityGroupId": "${{ vars.US_EAST_2_SG_ID }}"}, - {"imageId": "${{ vars.US_EAST_2_AMI_ID }}", "subnetId": "${{ vars.US_EAST_2C_SUBNET_ID }}", "securityGroupId": "${{ vars.US_EAST_2_SG_ID }}"} - ] - iam-role-name: "${{ vars.DATA_PROCESSING_IAM_ROLE }}" - aws-resource-tags: > - [ - {"Key": "Name", "Value": "data-processing-gh-runner"}, - {"Key": "GitHubRepository", "Value": "${{ github.repository }}"}, - {"Key": "GitHubRef", "Value": "${{ github.ref }}"}, - {"Key": "GitHubPR", "Value": "${{ github.event.number }}"} - ] - execute-all-notebooks: - needs: - - launch-ec2-runner - runs-on: ${{ needs.launch-ec2-runner.outputs.label }} env: MILVUS_LITE_WORK_DIR: "/tmp/milvus_lite_work" HOME: "/tmp/milvus_lite_work" @@ -78,93 +35,33 @@ jobs: PYTHONPATH: ${{ github.workspace }} steps: - - name: Setup Environment - run: echo "Running on EC2 ${{ needs.launch-ec2-runner.outputs.ec2-instance-id }}" + # Create the redirected HOME/work directory first so that later steps + # (and the notebooks themselves) can safely write into it. + - name: Prepare Milvus Lite work directory + run: mkdir -p "${{ env.MILVUS_LITE_WORK_DIR }}" - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - - name: Setup System Dependencies (Python + CUDA Runtime) - run: | - # 1. Install Python and basic tools - sudo dnf install -y gcc gcc-c++ make git-core python3.11 python3.11-devel python3-pip libaio - - # 2. Install base runtime libraries (required by libcusparselt) - sudo dnf install -y cuda-libraries-12-4 - - # 3. Install the specific library Docling needs - sudo dnf install -y libcusparselt0-cuda-12.x86_64 - sudo dnf install -y nvshmem || echo "NVSHMEM not in repo, relying on pip" - - # 4. THE SAFETY CHECK: Hide System NCCL - # We remove the system libnccl so that when we put system paths first in LD_LIBRARY_PATH, - # PyTorch won't accidentally find this incompatible version. - sudo find /usr/lib64 /usr/local/cuda-*/lib64 -name "libnccl.so*" -exec rm -f {} \; + - name: Setup Python 3.11 + uses: actions/setup-python@v6 + with: + python-version: "3.11" - name: Install Python Dependencies run: | # Setup Pip - /usr/bin/python3.11 -m ensurepip --upgrade >/dev/null 2>&1 - /usr/bin/python3.11 -m pip install --upgrade pip setuptools wheel - - # 1. Install Requirements (Generic) - # We do this first so we can overwrite any bad CPU-versions it pulls in - /usr/bin/python3.11 -m pip install -r requirements-dev.txt - /usr/bin/python3.11 -m pip install -r scripts/subset_selection/requirements.txt - - # 2. Force Reinstall GPU-Specific Versions (From PyTorch Index) - # We run this separately so --index-url doesn't break other packages - /usr/bin/python3.11 -m pip install --force-reinstall -r tests/requirements-gpu.txt - - # 3. Register Kernel - /usr/bin/python3.11 -m ipykernel install --name "python3.11" --user + python -m pip install --upgrade pip setuptools wheel + + # Install test requirements (CPU-only: the notebooks install their + # own dependencies, such as docling/torch, from PyPI at runtime) + python -m pip install -r requirements-dev.txt + python -m pip install -r scripts/subset_selection/requirements.txt + + # Register Kernel + python -m ipykernel install --name "python3.11" --user - name: Execute Notebooks run: | export PYTHONPATH="$(pwd):$PYTHONPATH" - # 1. Find the pip installation folder - SITE_PACKAGES=$(/usr/bin/python3.11 -m pip show nvidia-nccl-cu12 | grep Location | awk '{print $2}') - if [ -z "$SITE_PACKAGES" ]; then - echo "ERROR: nvidia-nccl-cu12 not found. Cannot construct LD_LIBRARY_PATH." - exit 1 - fi - - # 2. Define the specific folders for the GPU libraries - NCCL_LIB="$SITE_PACKAGES/nvidia/nccl/lib" - NVSHMEM_LIB="$SITE_PACKAGES/nvidia/nvshmem/lib" - CUSPARSE_LIB="$SITE_PACKAGES/nvidia/cusparse/lib" - - # 3. Set up the Environment for Milvus (Crash prevention) - mkdir -p "${{ env.MILVUS_LITE_WORK_DIR }}" - - # 4. The "Sandwich" Library Path - # - /usr/lib64: FIRST. Milvus gets system libstdc++. - # - Nvidia Libs: SECOND. PyTorch gets its bundled GPU libs. - # - System CUDA: THIRD. Docling gets libcusparselt. - export LD_LIBRARY_PATH="/usr/lib64:$NCCL_LIB:$NVSHMEM_LIB:$CUSPARSE_LIB:/usr/local/cuda/lib64:$LD_LIBRARY_PATH" cd tests - /usr/bin/python3.11 -m pytest test_notebook_execution.py -v --tb=short - stop-ec2-runner: - permissions: - id-token: write # This is required for OIDC (AWS auth) - contents: read - needs: - - launch-ec2-runner - - execute-all-notebooks - runs-on: ubuntu-latest - if: ${{ always() }} - steps: - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5.1.1 - with: - role-to-assume: "arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ vars.DATA_PROCESSING_IAM_ROLE }}" - aws-region: us-east-2 - role-session-name: odh-data-processing # For tracking in CloudTrail - - - name: Stop EC2 runner - uses: machulav/ec2-github-runner@343a1b2ae682e681c3cec9a235d882da17ff04ef # v2.6.1 - with: - mode: stop - github-token: "${{ secrets.DATA_PROCESSING_GH_PERSONAL_ACCESS_TOKEN }}" - label: ${{ needs.launch-ec2-runner.outputs.label }} - ec2-instance-id: ${{ needs.launch-ec2-runner.outputs.ec2-instance-id }} - + python -m pytest test_notebook_execution.py -v --tb=short diff --git a/.github/workflows/execute-kfp-localrunners.yml b/.github/workflows/execute-kfp-localrunners.yml index a42960af..968df6a0 100644 --- a/.github/workflows/execute-kfp-localrunners.yml +++ b/.github/workflows/execute-kfp-localrunners.yml @@ -29,7 +29,6 @@ on: default: "" env: QUAY_REGISTRY: quay.io - INSTANCE_TYPE: "g6e.xlarge" jobs: # This job always runs and provides clear feedback to contributors @@ -41,112 +40,57 @@ jobs: echo "✅ PR received!" echo "" if [ "${{ github.repository }}" != "opendatahub-io/data-processing" ]; then - echo "ℹ️ Note: Full CI tests (EC2 runners, pipeline tests) only run on PRs to opendatahub-io/data-processing." + echo "ℹ️ Note: Full CI tests (pipeline tests) only run on PRs to opendatahub-io/data-processing." echo " Your PR will be tested automatically once submitted to the upstream repository's branch." else echo "🚀 Running full CI tests on upstream repository..." fi - launch-ec2-runner: + test-local-pipelines: if: github.repository == 'opendatahub-io/data-processing' runs-on: ubuntu-latest permissions: - id-token: write # This is required for OIDC (AWS auth) contents: read - outputs: - label: ${{ steps.start-ec2-runner.outputs.label }} - ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5.1.1 - with: - role-to-assume: "arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ vars.DATA_PROCESSING_IAM_ROLE }}" - aws-region: us-east-2 - role-session-name: odh-data-processing # For tracking in CloudTrail - - - name: Start Data Processing EC2 runner - id: start-ec2-runner - uses: machulav/ec2-github-runner@343a1b2ae682e681c3cec9a235d882da17ff04ef # v2.6.1 - with: - mode: start - github-token: "${{ secrets.DATA_PROCESSING_GH_PERSONAL_ACCESS_TOKEN }}" - ec2-instance-type: "${{ env.INSTANCE_TYPE }}" - availability-zones-config: > - [ - {"imageId": "${{ vars.US_EAST_2_AMI_ID }}", "subnetId": "${{ vars.US_EAST_2A_SUBNET_ID }}", "securityGroupId": "${{ vars.US_EAST_2_SG_ID }}"}, - {"imageId": "${{ vars.US_EAST_2_AMI_ID }}", "subnetId": "${{ vars.US_EAST_2B_SUBNET_ID }}", "securityGroupId": "${{ vars.US_EAST_2_SG_ID }}"}, - {"imageId": "${{ vars.US_EAST_2_AMI_ID }}", "subnetId": "${{ vars.US_EAST_2C_SUBNET_ID }}", "securityGroupId": "${{ vars.US_EAST_2_SG_ID }}"} - ] - iam-role-name: "${{ vars.DATA_PROCESSING_IAM_ROLE }}" - aws-resource-tags: > - [ - {"Key": "Name", "Value": "data-processing-gh-runner"}, - {"Key": "GitHubRepository", "Value": "${{ github.repository }}"}, - {"Key": "GitHubRef", "Value": "${{ github.ref }}"}, - {"Key": "GitHubPR", "Value": "${{ github.event.number }}"} - ] - test-local-pipelines: - if: github.repository == 'opendatahub-io/data-processing' - needs: - - launch-ec2-runner - runs-on: ${{ needs.launch-ec2-runner.outputs.label }} strategy: fail-fast: false matrix: pipeline: - docling-standard - docling-vlm - + steps: - - name: Setup Environment - run: echo "Running on EC2 ${{ needs.launch-ec2-runner.outputs.ec2-instance-id }}" + - uses: actions/checkout@v6 - - uses: actions/checkout@v4 - - name: Setup System Dependencies (Python + Docker) - run: | - # Install Python - sudo dnf install -y python3.11 python3-pip - - # Install Docker CE from official repository - sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo - sudo dnf install -y docker-ce docker-ce-cli containerd.io - - # Start Docker daemon - sudo systemctl start docker - sudo systemctl enable docker - - # Add current user to docker group - sudo usermod -aG docker $(whoami) - - # Apply group membership without logout (temporary for this session) - sudo chmod 666 /var/run/docker.sock + - name: Setup Python 3.11 + uses: actions/setup-python@v6 + with: + python-version: "3.11" + + # Docker is preinstalled and running on GitHub-hosted ubuntu runners, + # so no Docker installation is needed here. - name: Install minimal requirements run: | # Setup Pip - /usr/bin/python3.11 -m ensurepip --upgrade >/dev/null 2>&1 - /usr/bin/python3.11 -m pip install --upgrade pip + python -m pip install --upgrade pip + + # Install Requirements + python -m pip install docker kfp==2.16.1 - # 1. Install Requirements (Generic) - # We do this first so we can overwrite any bad CPU-versions it pulls in - /usr/bin/python3.11 -m pip install docker kfp==2.16.1 - name: Create output directory working-directory: kubeflow-pipelines/${{ matrix.pipeline }} run: | mkdir -p local_outputs chmod 777 local_outputs + - name: Log in to Quay Container Registry uses: docker/login-action@v3 with: registry: ${{ env.QUAY_REGISTRY }} username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_PASSWORD }} - + - name: Run local pipeline - timeout-minutes: 30 + timeout-minutes: 60 working-directory: kubeflow-pipelines/${{ matrix.pipeline }} run: | # Only set env vars if inputs are provided (non-empty) @@ -156,7 +100,8 @@ jobs: if [ -n "${{ github.event.inputs.docling_base_image }}" ]; then export DOCLING_BASE_IMAGE="${{ github.event.inputs.docling_base_image }}" fi - /usr/bin/python3.11 local_run.py + python local_run.py + - name: Upload logs on failure if: failure() uses: actions/upload-artifact@v4 @@ -164,29 +109,3 @@ jobs: name: ${{ matrix.pipeline }}-logs path: kubeflow-pipelines/${{ matrix.pipeline }}/local_outputs/ retention-days: 7 - stop-ec2-runner: - if: github.repository == 'opendatahub-io/data-processing' && always() - permissions: - id-token: write # This is required for OIDC (AWS auth) - contents: read - needs: - - launch-ec2-runner - - test-local-pipelines - - runs-on: ubuntu-latest - steps: - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 # v5.1.1 - with: - role-to-assume: "arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ vars.DATA_PROCESSING_IAM_ROLE }}" - aws-region: us-east-2 - role-session-name: odh-data-processing # For tracking in CloudTrail - - - name: Stop EC2 runner - uses: machulav/ec2-github-runner@343a1b2ae682e681c3cec9a235d882da17ff04ef # v2.6.1 - with: - mode: stop - github-token: "${{ secrets.DATA_PROCESSING_GH_PERSONAL_ACCESS_TOKEN }}" - label: ${{ needs.launch-ec2-runner.outputs.label }} - ec2-instance-id: ${{ needs.launch-ec2-runner.outputs.ec2-instance-id }} - diff --git a/tests/conftest.py b/tests/conftest.py index a7252fda..9422fbe2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,8 +7,11 @@ import pytest -# Notebooks to temporarily skip -SKIP_FOR_NOW = [] +# Notebooks excluded from test discovery (never collected or executed by CI +# or local `make test-notebooks`). +# document-conversion-vlm.ipynb runs the SmolDocling VLM locally, which is too +# slow without a GPU — execute it by hand on a GPU machine instead. +SKIP_FOR_NOW = ["document-conversion-vlm.ipynb"] def get_notebook_files(): """Discover all notebook files in the notebooks directory.""" diff --git a/tests/test_notebook_execution.py b/tests/test_notebook_execution.py index ab4f590e..f76e749d 100644 --- a/tests/test_notebook_execution.py +++ b/tests/test_notebook_execution.py @@ -40,7 +40,7 @@ def get_test_parameters(notebook_path: Optional[Path] = None): return notebook_specific_params.get(notebook_path.name, override_params) return override_params -def execute_single_notebook(notebook_path: Path,timeout: Optional[int] = 600) -> bool: +def execute_single_notebook(notebook_path: Path,timeout: Optional[int] = 1800) -> bool: """ Execute a single notebook with papermill. @@ -73,7 +73,7 @@ def execute_single_notebook(notebook_path: Path,timeout: Optional[int] = 600) -> @pytest.mark.parametrize("notebook_path", get_notebook_files(), ids=lambda path: str(path)) -def test_notebook_executes_without_error(notebook_path: Path,timeout: Optional[int] = 600): +def test_notebook_executes_without_error(notebook_path: Path,timeout: Optional[int] = 1800): """Test that each notebook executes without errors.""" # Skip backup/duplicate files