|
| 1 | +name: run-cluster |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + daft_version: |
| 7 | + type: string |
| 8 | + description: The wheel artifact to use |
| 9 | + required: false |
| 10 | + python_version: |
| 11 | + type: string |
| 12 | + description: The version of python to use |
| 13 | + required: false |
| 14 | + default: "3.9" |
| 15 | + |
| 16 | +jobs: |
| 17 | + run-command: |
| 18 | + runs-on: [self-hosted, linux, x64, ci-dev] |
| 19 | + timeout-minutes: 15 # Remove for ssh debugging |
| 20 | + permissions: |
| 21 | + id-token: write |
| 22 | + contents: read |
| 23 | + steps: |
| 24 | + - name: Checkout repo |
| 25 | + uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + fetch-depth: 1 |
| 28 | + - name: Configure AWS credentials |
| 29 | + uses: aws-actions/configure-aws-credentials@v4 |
| 30 | + with: |
| 31 | + aws-region: us-west-2 |
| 32 | + role-session-name: run-command-workflow |
| 33 | + - name: Install uv, rust, python |
| 34 | + uses: ./.github/actions/install |
| 35 | + with: |
| 36 | + python_version: ${{ inputs.python_version }} |
| 37 | + - name: Setup uv environment |
| 38 | + run: | |
| 39 | + uv v |
| 40 | + source .venv/bin/activate |
| 41 | + uv pip install ray[default] boto3 |
| 42 | + - name: Dynamically update ray config file |
| 43 | + run: | |
| 44 | + id="ray-ci-run-${{ github.run_id }}_${{ github.run_attempt }}" |
| 45 | + sed -i "s|{{RAY_CLUSTER_NAME}}|$id|g" .github/assets/benchmarking_ray_config.yaml |
| 46 | + sed -i 's|{{PYTHON_VERSION}}|${{ inputs.python_version }}|g' .github/assets/benchmarking_ray_config.yaml |
| 47 | + if [[ '${{ inputs.daft_version }}' ]]; then |
| 48 | + sed -i 's|{{DAFT_VERSION}}|==${{ inputs.daft_version }}|g' .github/assets/benchmarking_ray_config.yaml |
| 49 | + else |
| 50 | + sed -i 's|{{DAFT_VERSION}}||g' .github/assets/benchmarking_ray_config.yaml |
| 51 | + fi |
| 52 | + - name: Download private ssh key |
| 53 | + run: | |
| 54 | + KEY=$(aws secretsmanager get-secret-value --secret-id ci-github-actions-ray-cluster-key-3 --query SecretString --output text) |
| 55 | + echo "$KEY" >> ~/.ssh/ci-github-actions-ray-cluster-key.pem |
| 56 | + chmod 600 ~/.ssh/ci-github-actions-ray-cluster-key.pem |
| 57 | + - name: Spin up ray cluster |
| 58 | + run: | |
| 59 | + source .venv/bin/activate |
| 60 | + ray up .github/assets/benchmarking_ray_config.yaml -y |
| 61 | + - name: Setup connection to ray cluster |
| 62 | + run: | |
| 63 | + source .venv/bin/activate |
| 64 | + ray dashboard .github/assets/benchmarking_ray_config.yaml & |
| 65 | + - name: Submit job to ray cluster |
| 66 | + run: | |
| 67 | + source .venv/bin/activate |
| 68 | + ray job submit --address http://localhost:8265 -- python -c "print('Hello, world!')" |
| 69 | + - name: Spin down ray cluster |
| 70 | + if: always() |
| 71 | + run: | |
| 72 | + source .venv/bin/activate |
| 73 | + ray down .github/assets/benchmarking_ray_config.yaml -y |
0 commit comments