-
Notifications
You must be signed in to change notification settings - Fork 9
330 lines (301 loc) · 12 KB
/
rbln_vllm-rbln_pytest.yaml
File metadata and controls
330 lines (301 loc) · 12 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
name: vllm-rbln / PR / Pytest
on:
workflow_dispatch:
inputs:
ref:
description: "ref to checkout"
required: false
type: string
pr_number:
description: "PR number to run"
required: false
type: string
rebel_compiler_version:
description: "Version of rebel-compiler to use (optional)"
required: false
type: string
optimum_rbln_version:
description: "Version of optimum-rbln to use (optional)"
required: false
type: string
fail_fast:
description: "Whether to fail fast when one matrix job fails"
required: false
type: boolean
default: true
test_level:
description: "Test level for VLLM_RBLN_TEST_LEVEL environment variable"
required: false
type: string
workflow_call:
inputs:
ref:
description: "ref to checkout"
required: false
type: string
fail_fast:
description: "Whether to fail fast when one matrix job fails"
required: false
type: boolean
default: true
rebel_compiler_version:
description: "Version of rebel-compiler to use (optional)"
required: false
type: string
optimum_rbln_version:
description: "Version of optimum-rbln to use (optional)"
required: false
type: string
test_level:
description: "Test level for VLLM_RBLN_TEST_LEVEL environment variable"
required: false
type: string
env:
RBLN_VERBOSE: 6
jobs:
pytest:
name: Pytest (${{ matrix.test_type.name }})
runs-on: ${{ matrix.test_type.runner }}
strategy:
fail-fast: ${{ inputs.fail_fast }}
matrix:
test_type:
[
{
name : "core",
runner : "rbln-sw-k8s-general"
},
{
name : "worker",
runner : "rbln-sw-k8s-general"
},
]
steps:
- name: Checkout the vllm-rbln repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.pr_number && format('refs/pull/{0}/merge', inputs.pr_number) || (inputs.ref != '' && inputs.ref) || github.sha }}
submodules: recursive
fetch-depth: 0
- name: Parse vllm-cpu index URL from pyproject.toml
id: parse_index_url
run: |
VLLM_CPU_URL=$(python3 -c "import tomllib; f=open('pyproject.toml','rb'); config=tomllib.load(f); print(next(i['url'] for i in config.get('tool',{}).get('uv',{}).get('index',[]) if i.get('name')=='vllm-cpu'))")
echo "Parsed vllm-cpu URL: ${VLLM_CPU_URL}"
echo "VLLM_CPU_URL=${VLLM_CPU_URL}" >> $GITHUB_OUTPUT
- name: Get commit message
id: get_commit_message
run: |
if git rev-parse HEAD^2 >/dev/null 2>&1; then
COMMIT_MESSAGE=$(git log -1 --pretty=%B HEAD^2)
else
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
fi
echo "Commit message: $COMMIT_MESSAGE"
echo "message<<EOF" >> $GITHUB_OUTPUT
echo "$COMMIT_MESSAGE" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Check if test should be skipped
id: should_skip
env:
COMMIT_MESSAGE: ${{ steps.get_commit_message.outputs.message }}
run: |
SKIP=false
case "${{ matrix.test_type.name }}" in
"core")
if [[ "$COMMIT_MESSAGE" == *"[skip core]"* ]]; then
SKIP=true
fi
;;
"worker")
if [[ "$COMMIT_MESSAGE" == *"[skip worker]"* ]]; then
SKIP=true
fi
;;
esac
echo "skip=$SKIP" >> $GITHUB_OUTPUT
echo "Skip decision: $SKIP"
- name: Set up Python 3.12
if: steps.should_skip.outputs.skip != 'true'
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install rebel-compiler
if: steps.should_skip.outputs.skip != 'true'
run: |
for i in {1..3}; do
sudo apt-get update && break || sleep 10
done
sudo apt-get install -y build-essential
python3 -m pip uninstall rebel-compiler -y
VERSION="${{ inputs.rebel_compiler_version }}"
if [ -z "$VERSION" ]; then
echo "Error: rebel_compiler_version is not set"
exit 1
fi
echo "rebel-compiler ${VERSION}"
python3 -m pip install --extra-index-url ${{ secrets.DEV_PKG_URL }} rebel-compiler=="${VERSION}"
- name: Download wheel artifact
if: steps.should_skip.outputs.skip != 'true'
uses: actions/download-artifact@v4
with:
name: vllm-wheel
path: dist
- name: Install local vllm-rbln package and dependencies
if: steps.should_skip.outputs.skip != 'true'
run: |
VLLM_CPU_URL="${{ steps.parse_index_url.outputs.VLLM_CPU_URL }}"
pip install packaging setuptools wheel simphile pynvml huggingface_hub setuptools_scm fire pytest pytest-asyncio
if [ -n "${{ inputs.optimum_rbln_version }}" ]; then
pip install --force-reinstall --no-cache-dir dist/vllm_rbln*.whl --constraint <(echo "optimum-rbln==${{ inputs.optimum_rbln_version }}") --index-url http://pypi-cache.devpi.svc.cluster.local/root/pypi/+simple/ --extra-index-url "${VLLM_CPU_URL}" --extra-index-url https://download.pytorch.org/whl/cpu --trusted-host pypi-cache.devpi.svc.cluster.local
echo "optimum-rbln ${{ inputs.optimum_rbln_version }}"
else
pip install --force-reinstall --no-cache-dir dist/vllm_rbln*.whl --index-url http://pypi-cache.devpi.svc.cluster.local/root/pypi/+simple/ --extra-index-url "${VLLM_CPU_URL}" --extra-index-url https://download.pytorch.org/whl/cpu --trusted-host pypi-cache.devpi.svc.cluster.local
fi
- name: Run pytest
if: steps.should_skip.outputs.skip != 'true'
env:
REBEL_VLLM_PRE_COMPILED_DIR: ${{ secrets.VLLM_PRE_COMPILED_DIR }}
run: |
case "${{ matrix.test_type.name }}" in
"core")
pytest tests/v1/core -vv --durations 0
;;
"worker")
pytest tests/v1/worker/test_rebel_optimum_model_runner.py -vv --durations 0
;;
esac
- name: Skip message
if: steps.should_skip.outputs.skip == 'true'
run: |
echo "Found [skip-${{ matrix.test_type.name }}] in commit message, skipping CI"
pytest-arc:
name: Pytest (${{ matrix.test_type.name }})
runs-on: ${{ matrix.test_type.runner }}
container:
image: mcr.microsoft.com/devcontainers/python:3.12
defaults:
run:
shell: bash
strategy:
fail-fast: ${{ inputs.fail_fast }}
matrix:
test_type:
[
{
name : "openai",
runner : "rbln-sw-k8s-ca22-4"
},
{
name : "sampler",
runner : "rbln-sw-k8s-ca22-1"
},
]
steps:
- name: Checkout the vllm-rbln repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.pr_number && format('refs/pull/{0}/merge', inputs.pr_number) || (inputs.ref != '' && inputs.ref) || github.sha }}
submodules: recursive
fetch-depth: 0
- name: Fix git ownership
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Parse vllm-cpu index URL from pyproject.toml
id: parse_index_url
run: |
VLLM_CPU_URL=$(python3 -c "import tomllib; f=open('pyproject.toml','rb'); config=tomllib.load(f); print(next(i['url'] for i in config.get('tool',{}).get('uv',{}).get('index',[]) if i.get('name')=='vllm-cpu'))")
echo "Parsed vllm-cpu URL: ${VLLM_CPU_URL}"
echo "VLLM_CPU_URL=${VLLM_CPU_URL}" >> $GITHUB_OUTPUT
- name: Get commit message
id: get_commit_message
run: |
if git rev-parse HEAD^2 >/dev/null 2>&1; then
COMMIT_MESSAGE=$(git log -1 --pretty=%B HEAD^2)
else
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
fi
echo "Commit message: $COMMIT_MESSAGE"
echo "message<<EOF" >> $GITHUB_OUTPUT
echo "$COMMIT_MESSAGE" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Check if test should be skipped
id: should_skip
env:
COMMIT_MESSAGE: ${{ steps.get_commit_message.outputs.message }}
run: |
SKIP=false
case "${{ matrix.test_type.name }}" in
"openai")
if [[ "$COMMIT_MESSAGE" == *"[skip openai]"* ]]; then
SKIP=true
fi
;;
"sampler")
if [[ "$COMMIT_MESSAGE" == *"[skip worker]"* ]]; then
SKIP=true
fi
;;
esac
echo "skip=$SKIP" >> $GITHUB_OUTPUT
- name: Install uv CLI
if: steps.should_skip.outputs.skip != 'true'
run: |
pip install uv
- name: Install rebel-compiler
if: steps.should_skip.outputs.skip != 'true'
run: |
for i in {1..3}; do
apt-get update && break || sleep 10
done
apt-get install -y build-essential
uv pip uninstall --system rebel-compiler
VERSION="${{ inputs.rebel_compiler_version }}"
if [ -z "$VERSION" ]; then
echo "Error: rebel_compiler_version is not set"
exit 1
fi
echo "rebel-compiler ${VERSION}"
uv pip install --system --extra-index-url ${{ secrets.DEV_PKG_URL }} rebel-compiler=="${VERSION}"
- name: Download wheel artifact
if: steps.should_skip.outputs.skip != 'true'
uses: actions/download-artifact@v4
with:
name: vllm-wheel
path: dist
- name: Install local vllm-rbln package and dependencies
if: steps.should_skip.outputs.skip != 'true'
uses: nick-fields/retry@v3
with:
timeout_minutes: 15
max_attempts: 3
retry_wait_seconds: 30
retry_on: any
shell: bash
command: |
VLLM_CPU_URL="${{ steps.parse_index_url.outputs.VLLM_CPU_URL }}"
uv pip install --system packaging setuptools wheel simphile pynvml huggingface_hub setuptools_scm fire pytest pytest-asyncio pytest-xdist
if [ -n "${{ inputs.optimum_rbln_version }}" ]; then
uv pip install --system --force-reinstall --no-cache-dir dist/vllm_rbln*.whl --constraint <(echo "optimum-rbln==${{ inputs.optimum_rbln_version }}") --index-url http://pypi-cache.devpi.svc.cluster.local/root/pypi/+simple/ --extra-index-url "${VLLM_CPU_URL}" --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match
echo "optimum-rbln ${{ inputs.optimum_rbln_version }}"
else
uv pip install --system --force-reinstall --no-cache-dir dist/vllm_rbln*.whl --index-url http://pypi-cache.devpi.svc.cluster.local/root/pypi/+simple/ --extra-index-url "${VLLM_CPU_URL}" --extra-index-url https://download.pytorch.org/whl/cpu --index-strategy unsafe-best-match
fi
- name: Run pytest
if: steps.should_skip.outputs.skip != 'true'
env:
REBEL_VLLM_PRE_COMPILED_DIR: ${{ secrets.VLLM_PRE_COMPILED_DIR }}
run: |
case "${{ matrix.test_type.name }}" in
"openai")
pytest tests/entrypoints/openai -vv --durations 0
;;
"sampler")
pytest -n auto -k "warm_upTrue" tests/v1/worker/test_sampler.py -vv --durations 0
pytest -n auto -k "warm_upFalse" tests/v1/worker/test_sampler.py -vv --durations 0
;;
esac
- name: Skip message
if: steps.should_skip.outputs.skip == 'true'
run: |
echo "Found [skip-${{ matrix.test_type.name }}] in commit message, skipping CI"