forked from flagos-ai/FlagScale
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctional_tests_hetero_train.yml
More file actions
217 lines (198 loc) · 7.04 KB
/
Copy pathfunctional_tests_hetero_train.yml
File metadata and controls
217 lines (198 loc) · 7.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: Common Functional Tests - Heterogeneous Training
on:
workflow_call:
inputs:
platform:
required: true
type: string
description: Platform name (e.g., cuda, default)
test_matrix:
required: true
type: string
description: JSON array of test configurations
image:
required: true
type: string
runs_on:
required: true
type: string
container_volumes:
required: true
type: string
container_options:
required: true
type: string
pkg_mgr:
required: false
type: string
description: Package manager (pip, uv, conda). Default uv.
default: "uv"
env_name:
required: false
type: string
description: Conda environment name (for conda only)
default: ""
env_path:
required: false
type: string
description: Environment path (venv path for uv, conda installation path for conda)
default: "/opt/venv"
jobs:
functional_test_hetero_train:
defaults:
run:
shell: bash
env:
PROJECT_ROOT: ${{ github.workspace }}/FlagScale
runs-on: ${{ fromJson(inputs.runs_on) }}
strategy:
fail-fast: false
matrix:
test_config: ${{ fromJson(inputs.test_matrix) }}
container:
image: ${{ inputs.image }}
ports:
- 80
volumes: ${{ fromJson(inputs.container_volumes) }}
options: ${{ inputs.container_options }}
steps:
- name: Checkout code (attempt 1)
id: checkout_attempt_1
uses: actions/checkout@v4
continue-on-error: true
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event.pull_request.head.ref || github.ref }}
path: FlagScale
ssh-strict: true
ssh-user: git
persist-credentials: false
clean: true
sparse-checkout-cone-mode: true
fetch-tags: false
show-progress: true
lfs: false
submodules: false
set-safe-directory: true
- name: Checkout code (attempt 2)
if: steps.checkout_attempt_1.outcome == 'failure'
id: checkout_attempt_2
uses: actions/checkout@v4
continue-on-error: true
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event.pull_request.head.ref || github.ref }}
path: FlagScale
ssh-strict: true
ssh-user: git
persist-credentials: false
clean: true
sparse-checkout-cone-mode: true
fetch-tags: false
show-progress: true
lfs: false
submodules: false
set-safe-directory: true
- name: Checkout code (attempt 3)
if: steps.checkout_attempt_2.outcome == 'failure'
id: checkout_attempt_3
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event.pull_request.head.ref || github.ref }}
path: FlagScale
ssh-strict: true
ssh-user: git
persist-credentials: false
clean: true
sparse-checkout-cone-mode: true
fetch-tags: false
show-progress: true
lfs: false
submodules: false
set-safe-directory: true
- name: Set safe directory
run: |
git config --global --add safe.directory $PROJECT_ROOT
- name: Check environment info
run: cd $PROJECT_ROOT && bash ./tests/test_utils/runners/check_env.sh
- name: Install dependencies for heterogeneous training
run: |
set -euo pipefail
cd $PROJECT_ROOT
bash ./tests/test_utils/runners/setup_training_test_env.sh \
--platform '${{ inputs.platform }}' \
--pkg-mgr '${{ inputs.pkg_mgr }}' \
--env-name '${{ inputs.env_name }}' \
--env-path '${{ inputs.env_path }}' \
--install-cli
timeout-minutes: 30
- name: Run functional tests
id: functional_test
run: |
set -euo pipefail
cd $PROJECT_ROOT
PLATFORM='${{ inputs.platform }}'
DEVICE='${{ matrix.test_config.device }}'
TASK='${{ matrix.test_config.task }}'
MODEL='${{ matrix.test_config.model }}'
CASE='${{ matrix.test_config.case }}'
PKG_MGR='${{ inputs.pkg_mgr }}'
ENV_NAME='${{ inputs.env_name }}'
ENV_PATH='${{ inputs.env_path }}'
echo "Running functional tests for heterogeneous training"
echo "Platform: $PLATFORM"
echo "Device: $DEVICE"
echo "Task: $TASK"
echo "Model: $MODEL"
echo "Case: ${CASE:-all}"
echo "Package Manager: $PKG_MGR"
echo "Environment Name: $ENV_NAME"
echo "Environment Path: $ENV_PATH"
echo "Project root: $PROJECT_ROOT"
# Source environment utilities
source ./tools/install/utils/pyenv_utils.sh
# Activate environment based on package manager
case "$PKG_MGR" in
conda)
if [ -n "$ENV_NAME" ]; then
activate_conda "$ENV_NAME" "$ENV_PATH" || echo "⚠️ Conda activation failed"
fi
;;
uv)
if [ -n "$ENV_PATH" ] && [ -d "$ENV_PATH" ]; then
activate_uv_env "$ENV_PATH" || echo "⚠️ UV activation failed"
fi
;;
pip)
echo "ℹ️ Running tests with pip/system Python"
;;
esac
# Display Python environment info
echo "Python location: $(which python)"
echo "Python version: $(python --version)"
# Run functional tests using run_tests.sh
bash "$PROJECT_ROOT/tests/test_utils/runners/run_tests.sh" \
--platform "$PLATFORM" \
--device "$DEVICE" \
--type functional \
--task "$TASK" \
--model "$MODEL" \
--list "$CASE"
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "✅ Functional tests passed for $PLATFORM/$DEVICE/$TASK/$MODEL/$CASE"
else
echo "❌ Functional tests failed for $PLATFORM/$DEVICE/$TASK/$MODEL/$CASE (exit code: $exit_code)"
fi
echo "exit_code=$exit_code" >> $GITHUB_OUTPUT
exit $exit_code
timeout-minutes: 30
- name: Upload Functional Test Logs
if: always() && steps.functional_test.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: functional_tests-logs-${{ inputs.platform }}-${{ github.run_id }}-${{ matrix.test_config.task }}-${{ matrix.test_config.model }}
path: ${{ env.PROJECT_ROOT }}/tests/functional_tests/${{ matrix.test_config.task }}/${{ matrix.test_config.model }}/test_results
retention-days: 7
if-no-files-found: warn