|
| 1 | +# Copyright 2025 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# This workflow builds a stable stack for JetStream+Maxtext, runs benchmarks, |
| 16 | +# cleans up resources, and sends notifications. |
| 17 | + |
| 18 | +name: Run Maxtext JetStream Tests |
| 19 | + |
| 20 | +on: |
| 21 | + # pull_request: |
| 22 | + # push: |
| 23 | + # branches: [ "main" ] |
| 24 | + workflow_dispatch: |
| 25 | + schedule: |
| 26 | + # Run the job daily at midnight UTC |
| 27 | + - cron: '0 0 * * *' |
| 28 | + |
| 29 | +jobs: |
| 30 | + prelim: |
| 31 | + runs-on: ["self-hosted", "tpu", "v6e-8"] |
| 32 | + steps: |
| 33 | + - name: Test gsutil installation |
| 34 | + run: which gsutil >/dev/null 2>&1 || { echo >&2 "gsutil is required but not installed. Aborting"; exit 24;} |
| 35 | + - name: Cleanup old docker images |
| 36 | + run: docker system prune --all --force |
| 37 | + - name: Authenticate gcloud |
| 38 | + run: gcloud auth configure-docker gcr.io --quiet |
| 39 | + |
| 40 | + build_stable_stack: |
| 41 | + name: Build Stable Stack |
| 42 | + needs: prelim |
| 43 | + runs-on: ["self-hosted", "tpu", "v6e-8"] |
| 44 | + env: |
| 45 | + LOCAL_IMAGE_TAG: jetstream-maxtext-stable-stack/tpu:github_${{ github.run_id }} |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + - name: Authenticate gcloud |
| 49 | + run: gcloud auth configure-docker gcr.io --quiet |
| 50 | + - name: Build |
| 51 | + run: | |
| 52 | + pushd experimental/jetstream-maxtext-stable-stack |
| 53 | + ./build.sh \ |
| 54 | + LOCAL_IMAGE_TAG="${LOCAL_IMAGE_TAG}" |
| 55 | + popd |
| 56 | + - name: Test |
| 57 | + run: | |
| 58 | + pushd experimental/jetstream-maxtext-stable-stack |
| 59 | + ./test.sh \ |
| 60 | + LOCAL_IMAGE_TAG=${LOCAL_IMAGE_TAG} |
| 61 | + popd |
| 62 | + - name: Upload image |
| 63 | + run: | |
| 64 | + UPLOAD_IMAGE_TAG=gcr.io/cloud-ml-auto-solutions/${LOCAL_IMAGE_TAG} |
| 65 | + docker tag ${LOCAL_IMAGE_TAG} ${UPLOAD_IMAGE_TAG} |
| 66 | + docker push ${UPLOAD_IMAGE_TAG} |
| 67 | +
|
| 68 | + benchmark_report: |
| 69 | + name: Benchmark Report |
| 70 | + needs: build_stable_stack |
| 71 | + runs-on: ["self-hosted", "tpu", "v6e-8"] |
| 72 | + env: |
| 73 | + OUTPUT_DIR: ./test_dir |
| 74 | + steps: |
| 75 | + - name: Test MOEBenchmarks |
| 76 | + run: | |
| 77 | + rm -rf ${OUTPUT_DIR} |
| 78 | + mkdir -p ${OUTPUT_DIR} |
| 79 | + # sync with the image uploaded from build_stable_stack stage |
| 80 | + # Report should generated in OUTPUT_DIR depend on ENV |
| 81 | + DOCKER_OUTPUT_DIR=/output |
| 82 | + docker run \ |
| 83 | + -v ${OUTPUT_DIR}:${DOCKER_OUTPUT_DIR} \ |
| 84 | + --env OUTPUT_DIR=${DOCKER_OUTPUT_DIR} \ |
| 85 | + --privileged --net=host --rm -i \ |
| 86 | + gcr.io/cloud-ml-auto-solutions/jetstream-maxtext-stable-stack/tpu:github_${{ github.run_id }} \ |
| 87 | + bash -c " |
| 88 | + bash JetStream/.github/workflows/test_moe_benchmarks.sh |
| 89 | + " |
| 90 | + - name: Upload build artifact |
| 91 | + uses: actions/upload-artifact@v4 |
| 92 | + with: |
| 93 | + name: benchmark_report |
| 94 | + path: ${{ env.OUTPUT_DIR }} |
| 95 | + |
| 96 | + clean_up_on_fail: |
| 97 | + if: ${{ failure() }} |
| 98 | + needs: [build_stable_stack, benchmark_report] |
| 99 | + name: "Clean up" |
| 100 | + runs-on: ["self-hosted"] |
| 101 | + permissions: |
| 102 | + contents: read |
| 103 | + issues: write # for failed-build-issue |
| 104 | + steps: |
| 105 | + - name: Authenticate gcloud |
| 106 | + run: gcloud auth configure-docker gcr.io --quiet |
| 107 | + - name: Delete TPU image |
| 108 | + # sync with the image uploaded from build_stable_stack stage |
| 109 | + run: gcloud container images delete gcr.io/cloud-ml-auto-solutions/jetstream-maxtext-stable-stack/tpu:github_${{ github.run_id }} --force-delete-tags --quiet |
| 110 | + |
| 111 | + tag_night_image: |
| 112 | + needs: [build_stable_stack, benchmark_report] |
| 113 | + name: "Tag night image" |
| 114 | + runs-on: ["self-hosted"] |
| 115 | + permissions: |
| 116 | + contents: read |
| 117 | + issues: write # for failed-build-issue |
| 118 | + steps: |
| 119 | + - name: Authenticate gcloud |
| 120 | + run: gcloud auth configure-docker gcr.io --quiet |
| 121 | + - name: Upload night image |
| 122 | + # sync with the image uploaded from build_stable_stack stage |
| 123 | + run: | |
| 124 | + UPLOAD_IMAGE_TAG=gcr.io/cloud-ml-auto-solutions/jetstream-maxtext-stable-stack/tpu:github_${{ github.run_id }} |
| 125 | + NIGHTLY_TAG=${UPLOAD_IMAGE_TAG%:*}:nightly |
| 126 | + NIGHTLY_TAG_DATE=${NIGHTLY_TAG}-$(date +"%Y%m%d") |
| 127 | + gcloud container images add-tag ${UPLOAD_IMAGE_TAG} ${NIGHTLY_TAG} --quiet |
| 128 | + gcloud container images add-tag ${UPLOAD_IMAGE_TAG} ${NIGHTLY_TAG_DATE} --quiet |
| 129 | + gcloud container images untag ${UPLOAD_IMAGE_TAG} --quiet |
| 130 | +
|
| 131 | + notify: |
| 132 | + name: Notify test build # creates an issue or modifies last open existing issue for failed build |
| 133 | + needs: [build_stable_stack, benchmark_report] |
| 134 | + runs-on: ["self-hosted", "tpu", "v6e-8"] |
| 135 | + env: |
| 136 | + BENCHMARK_REPORT_DIR: ./benchmark_report |
| 137 | + steps: |
| 138 | + - name: Clean previous artifact |
| 139 | + run: rm -rf ${{ env.BENCHMARK_REPORT_DIR }} |
| 140 | + - name: Download benchmark artifact |
| 141 | + uses: actions/download-artifact@v4 |
| 142 | + with: |
| 143 | + name: benchmark_report |
| 144 | + path: ${{ env.BENCHMARK_REPORT_DIR }} |
| 145 | + - name: Check whether one of the jobs failed |
| 146 | + if: ${{ failure() }} |
| 147 | + uses: jayqi/failed-build-issue-action@1a893bbf43ef1c2a8705e2b115cd4f0fe3c5649b # v1.2.0 |
| 148 | + with: |
| 149 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 150 | + - name: Log message if dependent job succeeded |
| 151 | + if: ${{ ! (failure() && github.event.pull_request == null) }} |
| 152 | + run: echo "Conditions for creating/updating issue not met. Skipping." |
| 153 | + - name: Send email |
| 154 | + uses: dawidd6/action-send-mail@v3.6.0 |
| 155 | + with: |
| 156 | + server_address: smtp.gmail.com |
| 157 | + server_port: 465 |
| 158 | + username: ${{secrets.MAIL_USERNAME}} |
| 159 | + password: ${{secrets.MAIL_PASSWORD}} |
| 160 | + subject: Message from Inference Stable Stack Runs. |
| 161 | + to: singhvijaya@google.com, yuyanpeng@google.com, vipannalla@google.com |
| 162 | + from: JetStream Runs |
| 163 | + secure: true |
| 164 | + attachments: ${{ env.BENCHMARK_REPORT_DIR }}/moe_8x7b.txt,${{ env.BENCHMARK_REPORT_DIR }}/moe_8x22b.txt,${{ env.BENCHMARK_REPORT_DIR }}/moe_8x22b_long_context_8k_prefill.txt,${{ env.BENCHMARK_REPORT_DIR }}/moe_8x7b_jetstream.txt |
| 165 | + body: workflow for ${{github.repository}} completed successfully! |
0 commit comments