@@ -61,12 +61,48 @@ permissions:
6161 contents : read
6262
6363jobs :
64+ setup-parameters :
65+ name : Setup Parameters
66+ runs-on : ubuntu-latest
67+ outputs :
68+ worker_groups : ${{ steps.set-params.outputs.worker_groups }}
69+ total_workers : ${{ steps.set-params.outputs.total_workers }}
70+ steps :
71+ - id : set-params
72+ name : Set Worker Parameters
73+ run : |
74+ # CPU worker constants
75+ CPU_UNIT_TOTAL_WORKERS=4
76+ CPU_UNIT_WORKER_GROUPS='[1, 2, 3, 4]'
77+
78+ # TPU worker constants
79+ TPU_UNIT_TOTAL_WORKERS=2
80+ TPU_UNIT_WORKER_GROUPS='[1, 2]'
81+
82+ # Default fallback constants
83+ DEFAULT_TOTAL_WORKERS=1
84+ DEFAULT_WORKER_GROUPS='[1]'
85+
86+ FLAVOR="${{ inputs.flavor }}"
87+
88+ if [[ "$FLAVOR" == "cpu-unit" || "$FLAVOR" == "cpu-post-training-unit" ]]; then
89+ echo "worker_groups=${CPU_UNIT_WORKER_GROUPS}" >> "$GITHUB_OUTPUT"
90+ echo "total_workers=${CPU_UNIT_TOTAL_WORKERS}" >> "$GITHUB_OUTPUT"
91+ elif [[ "$FLAVOR" == "tpu-unit" ]]; then
92+ echo "worker_groups=${TPU_UNIT_WORKER_GROUPS}" >> "$GITHUB_OUTPUT"
93+ echo "total_workers=${TPU_UNIT_TOTAL_WORKERS}" >> "$GITHUB_OUTPUT"
94+ else
95+ echo "worker_groups=${DEFAULT_WORKER_GROUPS}" >> "$GITHUB_OUTPUT"
96+ echo "total_workers=${DEFAULT_TOTAL_WORKERS}" >> "$GITHUB_OUTPUT"
97+ fi
98+
6499 execute-test-package :
100+ needs : setup-parameters
65101 name : ${{ inputs.flavor }}
66102 strategy :
67103 fail-fast : false
68104 matrix :
69- worker_group : ${{ fromJSON(contains(inputs.flavor, 'cpu-unit') && '[1, 2, 3, 4]' || '[1]' ) }}
105+ worker_group : ${{ fromJSON(needs.setup-parameters.outputs.worker_groups ) }}
70106
71107 uses : ./.github/workflows/run_tests_against_package.yml
72108 with :
@@ -158,6 +194,6 @@ jobs:
158194 is_scheduled_run : ${{ inputs.is_scheduled_run }}
159195 maxtext_installed : ${{ inputs.maxtext_installed }}
160196 worker_group : ${{ matrix.worker_group }}
161- total_workers : ${{ contains(inputs.flavor, 'cpu-unit') && 4 || 1 }}
197+ total_workers : ${{ fromJSON(needs.setup-parameters.outputs.total_workers) }}
162198 maxtext_sha : ${{ inputs.maxtext_sha }}
163199 is_update_hlo : ${{ inputs.is_update_hlo }}
0 commit comments