Skip to content

Commit 6cbe726

Browse files
systalyze-aijcarin-sysRSudarsananarminghobadi
committed
Resolve merge conflicts: merge main into PR #4911 with ring_axis support
Merged main branch which simplified dcn_parallelism handling. Kept ring_axis logic from PR while using the cleaner config.dcn_parallelism.copy() from main. Co-Authored-By: Jeremy <jeremy@systalyze.com> Co-Authored-By: Sudarsanan <sudarsanan@systalyze.com> Co-Authored-By: Armin <armin@systalyze.com>
2 parents 927afcc + 0db2ad1 commit 6cbe726

246 files changed

Lines changed: 25336 additions & 8107 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/scripts/analyze_code_changes.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ EXCLUDED_FILES=(
112112
'^\.github/scripts/'
113113
'^tools/'
114114
'\.md$'
115+
'src/maxtext/version.py$'
115116
)
116117

117118
# Loop through every changed file

‎.github/workflows/build_package.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
build_and_upload:
4444
name: Build Wheel
4545
runs-on: ${{ inputs.cloud_runner != '' && inputs.cloud_runner || fromJson(format('["self-hosted", "{0}", "{1}"]', inputs.device_type, inputs.device_name)) }}
46+
timeout-minutes: 15
4647
container: python:3.12-slim-bookworm
4748
outputs:
4849
maxtext_sha: ${{ steps.vars.outputs.maxtext_sha }}

‎.github/workflows/check_docs_build.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
build-docs:
3333
name: Build Sphinx Docs
3434
runs-on: ubuntu-latest
35+
timeout-minutes: 15
3536
steps:
3637
- name: Checkout repository
3738
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0

‎.github/workflows/ci_pipeline.yml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
analyze_code_changes:
5252
name: Analyze Code Changes for Test Orchestration
5353
runs-on: ubuntu-latest
54+
timeout-minutes: 15
5455
outputs:
5556
run_tests: ${{ steps.check.outputs.run_tests }}
5657
run_notebooks: ${{ steps.check.outputs.run_notebooks }}
@@ -128,6 +129,7 @@ jobs:
128129
needs.analyze_code_changes.outputs.run_tests == 'true' &&
129130
needs.build_and_upload_maxtext_package.result == 'success'
130131
runs-on: ubuntu-latest
132+
timeout-minutes: 15
131133
outputs:
132134
total_workers: ${{ steps.set-params.outputs.total_workers }}
133135
worker_groups: ${{ steps.set-params.outputs.worker_groups }}
@@ -183,8 +185,7 @@ jobs:
183185
needs: [gate_test_run]
184186
if: |
185187
always() &&
186-
needs.gate_test_run.result == 'success' &&
187-
github.ref == 'refs/heads/main' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
188+
needs.gate_test_run.result == 'success' && github.event_name != 'pull_request'
188189
uses: ./.github/workflows/run_tests_coordinator.yml
189190
strategy:
190191
fail-fast: false
@@ -305,6 +306,7 @@ jobs:
305306
needs: [build_and_upload_maxtext_package, gate_test_run, tpu-pretrain-tests, tpu-posttrain-tests, tpu7x-tests, gpu-tests, cpu-pretrain-tests, cpu-posttrain-tests, maxtext_tpu_pathways_unit_tests, maxtext_tpu_pathways_integration_tests, code_quality_check, docs_build_check]
306307
if: always()
307308
runs-on: ubuntu-latest
309+
timeout-minutes: 15
308310
steps:
309311
- name: Check test results
310312
run: |
@@ -348,6 +350,7 @@ jobs:
348350
needs: [analyze_code_changes, build_and_upload_maxtext_package, maxtext_jupyter_notebooks]
349351
if: always()
350352
runs-on: ubuntu-latest
353+
timeout-minutes: 15
351354
steps:
352355
- name: Check notebooks results
353356
run: |
@@ -377,6 +380,7 @@ jobs:
377380
needs: [gate_test_run, tpu-pretrain-tests, tpu-posttrain-tests, tpu7x-tests, gpu-tests, cpu-pretrain-tests, cpu-posttrain-tests, maxtext_jupyter_notebooks, maxtext_tpu_pathways_unit_tests, maxtext_tpu_pathways_integration_tests, code_quality_check, docs_build_check]
378381
if: ${{ always() }}
379382
runs-on: ubuntu-latest
383+
timeout-minutes: 15
380384
permissions:
381385
issues: write
382386
steps:

‎.github/workflows/code_quality.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
qa:
2929
name: "Pre-commit Linters"
3030
runs-on: ubuntu-latest
31+
timeout-minutes: 15
3132
steps:
3233
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
3334
with:

‎.github/workflows/promote_docker_image.yml‎

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
# 2. If the DAG succeeded, it promotes the Docker images by tagging the artifact with the latest tag.
1919

2020
name: Promote MaxText Docker Image
21+
run-name: "Triggered by Airflow ${{ github.event.client_payload.test_type }} Tests DAG"
2122

2223
on:
2324
repository_dispatch:
@@ -39,11 +40,11 @@ jobs:
3940
DAG_ID: ${{ github.event.client_payload.dag_id }}
4041
DAG_RUN_ID: ${{ github.event.client_payload.dag_run_id }}
4142
SHA: ${{ github.event.client_payload.sha }}
42-
GITHUB_RUN_ID: ${{ github.event.client_payload.github_run_id }}
43+
CALLER_RUN_ID: ${{ github.event.client_payload.github_run_id }}
4344
TEST_TYPE: ${{ github.event.client_payload.test_type }}
4445
run: |
4546
echo "================================"
46-
echo "Github Run ID: ${GITHUB_RUN_ID}"
47+
echo "Github Run ID: ${CALLER_RUN_ID}"
4748
echo "DAG ID: ${DAG_ID}"
4849
echo "DAG Run ID: ${DAG_RUN_ID}"
4950
echo "Commit SHA: ${SHA}"
@@ -57,16 +58,16 @@ jobs:
5758
*) echo "DAG ended with unexpected state: ${STATE}"; exit 1 ;;
5859
esac
5960
60-
if [ -n "$GITHUB_RUN_ID" ]; then
61-
echo "Checking nightly build status for run: $GITHUB_RUN_ID"
62-
gh run watch "$GITHUB_RUN_ID" --exit-status --interval 60 --repo "$GITHUB_REPOSITORY"
61+
if [ -n "$CALLER_RUN_ID" ]; then
62+
echo "Checking nightly build status for run: $CALLER_RUN_ID"
63+
gh run watch "$CALLER_RUN_ID" --exit-status --interval 60 --repo "$GITHUB_REPOSITORY"
6364
else
6465
echo "Error: No Github Run ID provided. Cannot verify nightly build status."
6566
exit 1
6667
fi
6768
6869
tag_docker_image:
69-
name: Promote ${{ matrix.image_name }} Docker Image
70+
name: Promote ${{ matrix.test_type }} Docker Image
7071
needs: handle_result
7172
if: needs.handle_result.result == 'success'
7273
runs-on: linux-x86-n2-16-buildkit
@@ -76,13 +77,11 @@ jobs:
7677
matrix:
7778
include:
7879
- test_type: pre_training
79-
image_name: maxtext_jax_nightly
80+
stable_image_name: maxtext_jax_stable
81+
nightly_image_name: maxtext_jax_nightly
8082
- test_type: post_training
81-
image_name: maxtext_post_training_nightly
82-
- test_type: pre_training
83-
image_name: maxtext_jax_stable
84-
- test_type: post_training
85-
image_name: maxtext_post_training_stable
83+
stable_image_name: maxtext_post_training_stable
84+
nightly_image_name: maxtext_post_training_nightly
8685
steps:
8786
- name: Configure Docker
8887
if: ${{ github.event.client_payload.test_type == '' || github.event.client_payload.test_type == matrix.test_type }}
@@ -91,15 +90,33 @@ jobs:
9190
if: ${{ github.event.client_payload.test_type == '' || github.event.client_payload.test_type == matrix.test_type }}
9291
shell: bash
9392
env:
94-
GITHUB_RUN_ID: ${{ github.event.client_payload.github_run_id }}
93+
CALLER_RUN_ID: ${{ github.event.client_payload.github_run_id }}
9594
PROJECT_NAME: ${{ vars.PROJECT_NAME }}
96-
IMAGE_NAME: ${{ matrix.image_name }}
95+
STABLE_IMAGE_NAME: ${{ matrix.stable_image_name }}
96+
NIGHTLY_IMAGE_NAME: ${{ matrix.nightly_image_name }}
9797
run: |
98-
SOURCE_IMAGE="gcr.io/${PROJECT_NAME}/${IMAGE_NAME}"
98+
tag_image() {
99+
local img="$1"
100+
local tag="$2"
101+
echo "Tagging ${img}:${CALLER_RUN_ID} as ${tag}..."
102+
gcloud container images add-tag "${img}:${CALLER_RUN_ID}" "${img}:${tag}" --quiet
103+
}
99104
100-
# Add the traceability tag to confirm it passed validation suite
101-
gcloud container images add-tag "${SOURCE_IMAGE}:${GITHUB_RUN_ID}" \
102-
"${SOURCE_IMAGE}:verified-${GITHUB_RUN_ID}" --quiet
105+
# 1. Check if stable image exists and tag it
106+
STABLE_IMAGE="gcr.io/${PROJECT_NAME}/${STABLE_IMAGE_NAME}"
107+
if gcloud container images describe "${STABLE_IMAGE}:${CALLER_RUN_ID}" >/dev/null 2>&1; then
108+
echo "Stable image ${STABLE_IMAGE}:${CALLER_RUN_ID} exists. Tagging stable image..."
109+
tag_image "${STABLE_IMAGE}" "verified-e2e-${CALLER_RUN_ID}"
110+
tag_image "${STABLE_IMAGE}" "latest"
111+
else
112+
echo "Stable image ${STABLE_IMAGE}:${CALLER_RUN_ID} does not exist. Skipping stable image tagging."
113+
fi
103114
104-
# Add "latest" tag
105-
gcloud container images add-tag "${SOURCE_IMAGE}:${GITHUB_RUN_ID}" "${SOURCE_IMAGE}:latest" --quiet
115+
# 2. Check if nightly image exists and tag it
116+
NIGHTLY_IMAGE="gcr.io/${PROJECT_NAME}/${NIGHTLY_IMAGE_NAME}"
117+
if gcloud container images describe "${NIGHTLY_IMAGE}:${CALLER_RUN_ID}" >/dev/null 2>&1; then
118+
echo "Nightly image ${NIGHTLY_IMAGE}:${CALLER_RUN_ID} exists. Tagging nightly image..."
119+
tag_image "${NIGHTLY_IMAGE}" "latest"
120+
else
121+
echo "Nightly image ${NIGHTLY_IMAGE}:${CALLER_RUN_ID} does not exist. Skipping nightly image tagging."
122+
fi

‎.github/workflows/pypi_release.yml‎

Lines changed: 22 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,23 @@
1616

1717
name: Publish MaxText to PyPI
1818

19-
# Triggered by Airflow when E2E DAG completes or can be manually triggered via workflow_dispatch.
19+
# Triggered by release_pipeline.yml via workflow_call or manually via workflow_dispatch.
2020
on:
21-
repository_dispatch:
22-
types: [airflow-dag-complete]
21+
workflow_call:
22+
inputs:
23+
run_id:
24+
description: 'GitHub workflow run_id passed to the Airflow DAG run.'
25+
required: true
26+
type: string
27+
maxtext_sha:
28+
description: 'MaxText SHA to release to PyPI.'
29+
required: true
30+
type: string
31+
publish:
32+
description: 'Set to true to publish to PyPI.'
33+
required: false
34+
default: true
35+
type: boolean
2336
workflow_dispatch:
2437
inputs:
2538
run_id:
@@ -40,77 +53,33 @@ permissions:
4053
contents: read
4154

4255
jobs:
43-
handle_result:
44-
name: Handle Airflow DAG Result
45-
runs-on: ubuntu-latest
46-
# Only run this job if the event that triggered the workflow is 'repository_dispatch'
47-
if: github.event_name == 'repository_dispatch'
48-
steps:
49-
- name: Report DAG result
50-
env:
51-
STATE: ${{ github.event.client_payload.state }}
52-
DAG_ID: ${{ github.event.client_payload.dag_id }}
53-
DAG_RUN_ID: ${{ github.event.client_payload.dag_run_id }}
54-
SHA: ${{ github.event.client_payload.sha }}
55-
run: |
56-
57-
echo "================================"
58-
echo "DAG ID: ${DAG_ID}"
59-
echo "DAG Run ID: ${DAG_RUN_ID}"
60-
echo "Commit SHA: ${SHA}"
61-
echo "State: ${STATE}"
62-
echo "================================"
63-
64-
# Evaluate state
65-
case "${STATE}" in
66-
success)
67-
echo "DAG '${DAG_ID}' completed successfully."
68-
exit 0
69-
;;
70-
failed|upstream_failed)
71-
echo "DAG '${DAG_ID}' failed with state: ${STATE}."
72-
exit 1
73-
;;
74-
*)
75-
echo "DAG '${DAG_ID}' ended with unexpected state: ${STATE}."
76-
exit 1
77-
;;
78-
esac
79-
8056
release_approval:
8157
name: Approve Release
8258
runs-on: ubuntu-latest
83-
needs: handle_result
84-
if: |
85-
always() &&
86-
(needs.handle_result.result == 'success' || needs.handle_result.result == 'skipped') &&
87-
(github.event_name == 'repository_dispatch' || inputs.publish)
59+
if: inputs.publish == true
8860
# "release" environment is configured in MaxText repository settings.
8961
# This environment requires manual approval before proceeding to the next job.
9062
environment: release
9163
steps:
92-
- name: Acknowledge Approval
93-
run: echo "Release approved, proceeding to publishing MaxText package."
64+
- name: Acknowledge Approval
65+
run: echo "Release approved, proceeding to publishing MaxText package."
9466

9567
build_maxtext_package:
9668
needs: release_approval
97-
if: |
98-
always() &&
99-
(needs.release_approval.result == 'success' || needs.release_approval.result == 'skipped')
10069
uses: ./.github/workflows/build_package.yml
10170
with:
10271
device_type: tpu
10372
device_name: v4-8
10473
cloud_runner: linux-x86-n2-16-buildkit
10574
# Build package from a particular commit to ensure we are publishing the same code that was tested
106-
maxtext_sha: ${{ github.event.client_payload.sha || inputs.maxtext_sha }}
75+
maxtext_sha: ${{ inputs.maxtext_sha }}
10776

10877
publish_maxtext_to_pypi:
10978
name: Publish MaxText to PyPI
11079
needs: [release_approval, build_maxtext_package]
11180
runs-on: ubuntu-latest
11281
environment: release
113-
if: needs.build_maxtext_package.result == 'success' && (github.event_name == 'repository_dispatch' || inputs.publish)
82+
if: needs.build_maxtext_package.result == 'success' && inputs.publish
11483
permissions:
11584
id-token: write # required for PyPI Trusted Publishing (OIDC)
11685
contents: read
@@ -164,11 +133,10 @@ jobs:
164133
env:
165134
PROJECT_NAME: ${{ vars.PROJECT_NAME }}
166135
IMAGE_NAME: ${{ matrix.image_name }}
167-
RUN_ID_INPUT: ${{ github.event_name == 'workflow_dispatch' && inputs.run_id || github.event.client_payload.github_run_id }}
136+
GITHUB_RUN_ID: ${{ inputs.run_id }}
168137
PYPI_VERSION: ${{ needs.get_latest_maxtext_pypi_version.outputs.latest_pypi_version }}
169138
run: |
170139
SOURCE_IMAGE="gcr.io/${PROJECT_NAME}/${IMAGE_NAME}"
171-
GITHUB_RUN_ID="${RUN_ID_INPUT}"
172140
gcloud container images add-tag \
173141
"${SOURCE_IMAGE}:${GITHUB_RUN_ID}" \
174142
"${SOURCE_IMAGE}:${PYPI_VERSION}" \

0 commit comments

Comments
 (0)