forked from mlflow/mlflow
-
Notifications
You must be signed in to change notification settings - Fork 0
419 lines (397 loc) · 15 KB
/
master.yml
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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
name: MLflow tests
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
push:
branches:
- master
- branch-[0-9]+.[0-9]+
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
# Use `bash --noprofile --norc -exo pipefail` by default for all `run` steps in this workflow:
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaultsrun
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
env:
MLFLOW_HOME: /home/runner/work/mlflow/mlflow
# Note miniconda is pre-installed in the virtual environments for GitHub Actions:
# https://github.com/actions/virtual-environments/blob/main/images/linux/scripts/installers/miniconda.sh
MLFLOW_CONDA_HOME: /usr/share/miniconda
SPARK_LOCAL_IP: localhost
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu
PYTHONUTF8: "1"
jobs:
# python-skinny tests cover a subset of mlflow functionality
# that is meant to be supported with a smaller dependency footprint.
# The python skinny tests cover the subset of mlflow functionality
# while also verifying certain dependencies are omitted.
python-skinny:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 30
permissions: {}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- name: Install dependencies
run: |
source ./dev/install-common-deps.sh --skinny
- name: Run tests
run: |
./dev/run-python-skinny-tests.sh
python:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 120
permissions: {}
strategy:
fail-fast: false
matrix:
group: [1, 2]
include:
- splits: 2
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/free-disk-space
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- uses: ./.github/actions/cache-pip
- name: Install dependencies
run: |
python -m venv .venv
source .venv/bin/activate
source ./dev/install-common-deps.sh --ml
# transformers doesn't support Keras 3 yet. tf-keras needs to be installed as a workaround.
pip install tf-keras
- uses: ./.github/actions/show-versions
- uses: ./.github/actions/pipdeptree
- name: Import check
run: |
source .venv/bin/activate
python tests/check_mlflow_lazily_imports_ml_packages.py
- name: Run tests
run: |
source .venv/bin/activate
source dev/setup-ssh.sh
pytest --splits=${{ matrix.splits }} --group=${{ matrix.group }} --quiet --requires-ssh \
--ignore-flavors --ignore=tests/examples --ignore=tests/recipes --ignore=tests/evaluate \
--ignore tests/deployments/server tests
py310:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 60
permissions: {}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
with:
python-version: "3.10"
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- uses: ./.github/actions/cache-pip
- name: Install dependencies
run: |
source ./dev/install-common-deps.sh
pip install .
- uses: ./.github/actions/show-versions
- name: Run tests
run: |
python -c "import sys; assert sys.version_info[:2] == (3, 10), sys.version_info"
pytest tests/types/test_type_hints.py tests/pyfunc/test_pyfunc_model_with_type_hints.py
database:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 90
permissions: {}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/untracked
- name: Build
run: |
./tests/db/compose.sh pull -q postgresql mysql mssql
docker images
./tests/db/compose.sh build --build-arg DEPENDENCIES="$(cat requirements/skinny-requirements.txt requirements/core-requirements.txt | grep -Ev '^(#|$)')"
- name: Run tests
run: |
set +e
err=0
trap 'err=1' ERR
for service in $(./tests/db/compose.sh config --services | grep '^mlflow-' | sort)
do
# Set `--no-TTY` to show container logs on GitHub Actions:
# https://github.com/actions/virtual-environments/issues/5022
./tests/db/compose.sh run --rm --no-TTY $service pytest \
tests/store/tracking/test_sqlalchemy_store.py \
tests/store/model_registry/test_sqlalchemy_store.py \
tests/db
done
test $err = 0
- name: Run migration check
run: |
set +e
err=0
trap 'err=1' ERR
./tests/db/compose.sh down --volumes --remove-orphans
for service in $(./tests/db/compose.sh config --services | grep '^migration-')
do
./tests/db/compose.sh run --rm --no-TTY $service
done
test $err = 0
- name: Clean up
run: |
./tests/db/compose.sh down --volumes --remove-orphans --rmi all
java:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 30
permissions: {}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-java
- name: Install dependencies
run: |
source ./dev/install-common-deps.sh
- uses: ./.github/actions/show-versions
- uses: ./.github/actions/pipdeptree
- name: Run tests
run: |
cd mlflow/java
mvn clean package -q
flavors:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 120
permissions: {}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- uses: ./.github/actions/cache-pip
- name: Install dependencies
run: |
python -m venv .venv
source .venv/bin/activate
source ./dev/install-common-deps.sh --ml
# transformers doesn't support Keras 3 yet. tf-keras needs to be installed as a workaround.
pip install tf-keras uvicorn
# Required by mlflow.litellm. Temporarily update the version here due to version conflict with dspy.
pip install "litellm>=1.52.9"
- uses: ./.github/actions/show-versions
- uses: ./.github/actions/pipdeptree
- name: Run tests
run: |
source .venv/bin/activate
pytest \
tests/utils/test_model_utils.py \
tests/tracking/fluent/test_fluent_autolog.py \
tests/autologging \
tests/server/auth
# It takes 9 ~ 10 minutes to run tests in `tests/models`. To make CI finish faster,
# run these tests in a separate job.
models:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 120
permissions: {}
strategy:
fail-fast: false
matrix:
group: [1, 2]
include:
- splits: 2
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/free-disk-space
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- name: Install dependencies
run: |
source ./dev/install-common-deps.sh
pip install pyspark langchain langchain-community '.[mlserver]'
- uses: ./.github/actions/show-versions
- uses: ./.github/actions/pipdeptree
- name: Run tests
run: |
pytest --splits=${{ matrix.splits }} --group=${{ matrix.group }} tests/models
# NOTE: numpy is pinned in this suite due to its heavy reliance on shap, which internally uses
# references to the now fully deprecated (as of 1.24.x) numpy types (i.e., np.bool).
# When the shap cross version tests are passing in a new release version of shap, this pin should
# be removed.
evaluate:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 90
permissions: {}
strategy:
fail-fast: false
matrix:
group: [1, 2]
include:
- splits: 2
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- name: Install dependencies
run: |
source ./dev/install-common-deps.sh
pip install pyspark torch transformers langchain langchain-experimental '.[genai]'
- uses: ./.github/actions/show-versions
- uses: ./.github/actions/pipdeptree
- name: Run tests
run: |
pytest --splits=${{ matrix.splits }} --group=${{ matrix.group }} tests/evaluate --ignore=tests/evaluate/test_default_evaluator_delta.py
- name: Run tests with delta
run: |
pytest tests/evaluate/test_default_evaluator_delta.py
pyfunc:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 120
permissions: {}
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4]
include:
- splits: 4
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/free-disk-space
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- name: Install dependencies
run: |
source ./dev/install-common-deps.sh
pip install tensorflow 'pyspark[connect]'
pip install typing_extensions -U
- uses: ./.github/actions/show-versions
- uses: ./.github/actions/pipdeptree
- name: Run tests
run: |
pytest --splits=${{ matrix.splits }} --group=${{ matrix.group }} --durations=30 \
tests/pyfunc tests/types --ignore tests/pyfunc/test_spark_connect.py
# test_spark_connect.py fails if it's run with other tests, so run it separately.
pytest tests/pyfunc/test_spark_connect.py
- name: Run tests on pydantic v1
run: |
pip install 'pydantic<2'
pytest --splits=${{ matrix.splits }} --group=${{ matrix.group }} --durations=30 \
tests/types tests/pyfunc/test_pyfunc_model_with_type_hints.py tests/utils/test_pydantic_utils.py
sagemaker:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 120
permissions: {}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-java
- name: Install dependencies
run: |
source ./dev/install-common-deps.sh --ml
- uses: ./.github/actions/show-versions
- uses: ./.github/actions/pipdeptree
- name: Run tests
run: |
pytest tests/sagemaker
windows:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: windows-latest
timeout-minutes: 120
permissions: {}
strategy:
fail-fast: false
matrix:
group: [1, 2]
include:
- splits: 2
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/untracked
- uses: ./.github/actions/setup-python
- uses: ./.github/actions/setup-pyenv
- uses: ./.github/actions/setup-java
- uses: ./.github/actions/cache-pip
- name: Install python dependencies
run: |
python -m venv .venv
source .venv/Scripts/activate
python -m pip install -U pip
pip install --no-dependencies tests/resources/mlflow-test-plugin
pip install '.[extras,genai]'
pip install pyspark
# Install Hugging Face datasets to test Hugging Face usage with MLflow dataset tracking
pip install datasets
# Install TensorFlow to test TensorFlow dataset usage with MLflow dataset tracking
pip install tensorflow
# Install torch and transformers to test metrics
pip install torch transformers
pip install -r requirements/test-requirements.txt
# transformers doesn't support Keras 3 yet. tf-keras needs to be installed as a workaround.
pip install tf-keras
- uses: ./.github/actions/show-versions
- uses: ./.github/actions/pipdeptree
- name: Download Hadoop winutils for Spark
run: |
git clone https://github.com/cdarlint/winutils /tmp/winutils
- name: Run python tests
env:
# Starting from SQLAlchemy version 2.0, `QueuePool` is the default connection pool
# when creating an `Engine`. `QueuePool` prevents the removal of temporary database
# files created during tests on Windows as it keeps the DB connection open until
# it's explicitly disposed.
MLFLOW_SQLALCHEMYSTORE_POOLCLASS: "NullPool"
run: |
source .venv/Scripts/activate
# Set Hadoop environment variables required for testing Spark integrations on Windows
export HADOOP_HOME=/tmp/winutils/hadoop-3.2.2
export PATH=$PATH:$HADOOP_HOME/bin
# Run Windows tests
pytest --splits=${{ matrix.splits }} --group=${{ matrix.group }} \
--ignore-flavors --ignore=tests/projects --ignore=tests/examples --ignore=tests/recipes --ignore=tests/evaluate --ignore tests/deployments/server \
tests
# MLeap is incompatible on Windows with PySpark3.4 release.
# Reinstate tests when MLeap has released a fix. [ML-30491]
# pytest tests/mleap