forked from feast-dev/feast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
469 lines (389 loc) · 17.1 KB
/
Makefile
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
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
#
# Copyright 2019 The Feast Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
MVN := mvn -f java/pom.xml ${MAVEN_EXTRA_OPTS}
OS := linux
ifeq ($(shell uname -s), Darwin)
OS = osx
endif
TRINO_VERSION ?= 376
# General
format: format-python format-java format-go
lint: lint-python lint-java lint-go
test: test-python test-java test-go
protos: compile-protos-go compile-protos-python compile-protos-docs
build: protos build-java build-docker
# Python SDK
install-python-ci-dependencies: install-go-proto-dependencies install-go-ci-dependencies
python -m piptools sync sdk/python/requirements/py$(PYTHON)-ci-requirements.txt
COMPILE_GO=true python setup.py develop
lock-python-ci-dependencies:
python -m piptools compile -U --extra ci --output-file sdk/python/requirements/py$(PYTHON)-ci-requirements.txt
package-protos:
cp -r ${ROOT_DIR}/protos ${ROOT_DIR}/sdk/python/feast/protos
compile-protos-python:
python setup.py build_python_protos --inplace
install-python:
python -m piptools sync sdk/python/requirements/py$(PYTHON)-requirements.txt
python setup.py develop
lock-python-dependencies:
python -m piptools compile -U --output-file sdk/python/requirements/py$(PYTHON)-requirements.txt
benchmark-python:
FEAST_USAGE=False IS_TEST=True python -m pytest --integration --benchmark --benchmark-autosave --benchmark-save-data sdk/python/tests
benchmark-python-local:
FEAST_USAGE=False IS_TEST=True FEAST_IS_LOCAL_TEST=True python -m pytest --integration --benchmark --benchmark-autosave --benchmark-save-data sdk/python/tests
test-python:
FEAST_USAGE=False \
IS_TEST=True \
python -m pytest -n 8 sdk/python/tests \
test-python-integration:
FEAST_USAGE=False IS_TEST=True python -m pytest -n 8 --integration sdk/python/tests
test-python-integration-local:
@(docker info > /dev/null 2>&1 && \
FEAST_USAGE=False \
IS_TEST=True \
FEAST_IS_LOCAL_TEST=True \
FEAST_LOCAL_ONLINE_CONTAINER=True \
python -m pytest -n 8 --integration \
-k "not gcs_registry and \
not s3_registry and \
not test_lambda_materialization and \
not test_snowflake" \
sdk/python/tests \
) || echo "This script uses Docker, and it isn't running - please start the Docker Daemon and try again!";
test-python-integration-container:
@(docker info > /dev/null 2>&1 && \
FEAST_USAGE=False \
IS_TEST=True \
FEAST_LOCAL_ONLINE_CONTAINER=True \
python -m pytest -n 8 --integration sdk/python/tests \
) || echo "This script uses Docker, and it isn't running - please start the Docker Daemon and try again!";
test-python-universal-spark:
PYTHONPATH='.' \
FULL_REPO_CONFIGS_MODULE=sdk.python.feast.infra.offline_stores.contrib.spark_repo_configuration \
PYTEST_PLUGINS=feast.infra.offline_stores.contrib.spark_offline_store.tests \
FEAST_USAGE=False IS_TEST=True \
python -m pytest -n 8 --integration \
-k "not test_historical_retrieval_fails_on_validation and \
not test_historical_retrieval_with_validation and \
not test_historical_features_persisting and \
not test_historical_retrieval_fails_on_validation and \
not test_universal_cli and \
not test_go_feature_server and \
not test_feature_logging and \
not test_reorder_columns and \
not test_logged_features_validation and \
not test_lambda_materialization_consistency and \
not test_offline_write and \
not test_push_features_to_offline_store.py and \
not gcs_registry and \
not s3_registry and \
not test_universal_types and \
not test_snowflake" \
sdk/python/tests
test-python-universal-trino:
PYTHONPATH='.' \
FULL_REPO_CONFIGS_MODULE=sdk.python.feast.infra.offline_stores.contrib.trino_repo_configuration \
PYTEST_PLUGINS=feast.infra.offline_stores.contrib.trino_offline_store.tests \
FEAST_USAGE=False IS_TEST=True \
python -m pytest -n 8 --integration \
-k "not test_historical_retrieval_fails_on_validation and \
not test_historical_retrieval_with_validation and \
not test_historical_features_persisting and \
not test_historical_retrieval_fails_on_validation and \
not test_universal_cli and \
not test_go_feature_server and \
not test_feature_logging and \
not test_reorder_columns and \
not test_logged_features_validation and \
not test_lambda_materialization_consistency and \
not test_offline_write and \
not test_push_features_to_offline_store.py and \
not gcs_registry and \
not s3_registry and \
not test_universal_types and \
not test_snowflake" \
sdk/python/tests
# Note: to use this, you'll need to have Microsoft ODBC 17 installed.
# See https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/install-microsoft-odbc-driver-sql-server-macos?view=sql-server-ver15#17
test-python-universal-mssql:
PYTHONPATH='.' \
FULL_REPO_CONFIGS_MODULE=sdk.python.feast.infra.offline_stores.contrib.mssql_repo_configuration \
PYTEST_PLUGINS=feast.infra.offline_stores.contrib.mssql_offline_store.tests \
FEAST_USAGE=False IS_TEST=True \
FEAST_LOCAL_ONLINE_CONTAINER=True \
python -m pytest -n 8 --integration \
-k "not gcs_registry and \
not s3_registry and \
not test_lambda_materialization and \
not test_snowflake" \
sdk/python/tests
# To use Athena as an offline store, you need to create an Athena database and an S3 bucket on AWS.
# https://docs.aws.amazon.com/athena/latest/ug/getting-started.html
# Modify environment variables ATHENA_REGION, ATHENA_DATA_SOURCE, ATHENA_DATABASE, ATHENA_WORKGROUP or
# ATHENA_S3_BUCKET_NAME according to your needs. If tests fail with the pytest -n 8 option, change the number to 1.
test-python-universal-athena:
PYTHONPATH='.' \
FULL_REPO_CONFIGS_MODULE=sdk.python.feast.infra.offline_stores.contrib.athena_repo_configuration \
PYTEST_PLUGINS=feast.infra.offline_stores.contrib.athena_offline_store.tests \
FEAST_USAGE=False IS_TEST=True \
ATHENA_REGION=ap-northeast-2 \
ATHENA_DATA_SOURCE=AwsDataCatalog \
ATHENA_DATABASE=default \
ATHENA_WORKGROUP=primary \
ATHENA_S3_BUCKET_NAME=feast-integration-tests \
python -m pytest -n 8 --integration \
-k "not test_go_feature_server and \
not test_logged_features_validation and \
not test_lambda and \
not test_feature_logging and \
not test_offline_write and \
not test_push_offline and \
not test_historical_retrieval_with_validation and \
not test_historical_features_persisting and \
not test_historical_retrieval_fails_on_validation and \
not gcs_registry and \
not s3_registry and \
not test_snowflake" \
sdk/python/tests
test-python-universal-postgres-offline:
PYTHONPATH='.' \
FULL_REPO_CONFIGS_MODULE=sdk.python.feast.infra.offline_stores.contrib.postgres_repo_configuration \
PYTEST_PLUGINS=sdk.python.feast.infra.offline_stores.contrib.postgres_offline_store.tests \
FEAST_USAGE=False \
IS_TEST=True \
python -m pytest -n 8 --integration \
-k "not test_historical_retrieval_with_validation and \
not test_historical_features_persisting and \
not test_universal_cli and \
not test_go_feature_server and \
not test_feature_logging and \
not test_reorder_columns and \
not test_logged_features_validation and \
not test_lambda_materialization_consistency and \
not test_offline_write and \
not test_push_features_to_offline_store and \
not gcs_registry and \
not s3_registry and \
not test_universal_types" \
sdk/python/tests
test-python-universal-postgres-online:
PYTHONPATH='.' \
FULL_REPO_CONFIGS_MODULE=sdk.python.feast.infra.online_stores.contrib.postgres_repo_configuration \
PYTEST_PLUGINS=sdk.python.feast.infra.offline_stores.contrib.postgres_offline_store.tests \
FEAST_USAGE=False \
IS_TEST=True \
python -m pytest -n 8 --integration \
-k "not test_universal_cli and \
not test_go_feature_server and \
not test_feature_logging and \
not test_reorder_columns and \
not test_logged_features_validation and \
not test_lambda_materialization_consistency and \
not test_offline_write and \
not test_push_features_to_offline_store and \
not gcs_registry and \
not s3_registry and \
not test_universal_types and \
not test_snowflake" \
sdk/python/tests
test-python-universal-mysql-online:
PYTHONPATH='.' \
FULL_REPO_CONFIGS_MODULE=sdk.python.feast.infra.online_stores.contrib.mysql_repo_configuration \
PYTEST_PLUGINS=sdk.python.tests.integration.feature_repos.universal.online_store.mysql \
FEAST_USAGE=False \
IS_TEST=True \
python -m pytest -n 8 --integration \
-k "not test_universal_cli and \
not test_go_feature_server and \
not test_feature_logging and \
not test_reorder_columns and \
not test_logged_features_validation and \
not test_lambda_materialization_consistency and \
not test_offline_write and \
not test_push_features_to_offline_store and \
not gcs_registry and \
not s3_registry and \
not test_universal_types and \
not test_snowflake" \
sdk/python/tests
test-python-universal-cassandra:
PYTHONPATH='.' \
FULL_REPO_CONFIGS_MODULE=sdk.python.feast.infra.online_stores.contrib.cassandra_repo_configuration \
PYTEST_PLUGINS=sdk.python.tests.integration.feature_repos.universal.online_store.cassandra \
FEAST_USAGE=False \
IS_TEST=True \
python -m pytest -x --integration \
sdk/python/tests
test-python-universal-cassandra-no-cloud-providers:
PYTHONPATH='.' \
FULL_REPO_CONFIGS_MODULE=sdk.python.feast.infra.online_stores.contrib.cassandra_repo_configuration \
PYTEST_PLUGINS=sdk.python.tests.integration.feature_repos.universal.online_store.cassandra \
FEAST_USAGE=False \
IS_TEST=True \
python -m pytest -x --integration \
-k "not test_lambda_materialization_consistency and \
not test_apply_entity_integration and \
not test_apply_feature_view_integration and \
not test_apply_entity_integration and \
not test_apply_feature_view_integration and \
not test_apply_data_source_integration and \
not test_nullable_online_store and \
not gcs_registry and \
not s3_registry and \
not test_snowflake" \
sdk/python/tests
test-python-universal:
FEAST_USAGE=False IS_TEST=True python -m pytest -n 8 --integration sdk/python/tests
test-python-go-server: compile-go-lib
FEAST_USAGE=False IS_TEST=True pytest --integration --goserver sdk/python/tests
format-python:
# Sort
cd ${ROOT_DIR}/sdk/python; python -m isort feast/ tests/
# Format
cd ${ROOT_DIR}/sdk/python; python -m black --target-version py37 feast tests
lint-python:
cd ${ROOT_DIR}/sdk/python; python -m mypy
cd ${ROOT_DIR}/sdk/python; python -m isort feast/ tests/ --check-only
cd ${ROOT_DIR}/sdk/python; python -m flake8 feast/ tests/
cd ${ROOT_DIR}/sdk/python; python -m black --check feast tests
# Java
install-java-ci-dependencies:
${MVN} verify clean --fail-never
format-java:
${MVN} spotless:apply
lint-java:
${MVN} --no-transfer-progress spotless:check
test-java:
${MVN} --no-transfer-progress -DskipITs=true test
test-java-integration:
${MVN} --no-transfer-progress -Dmaven.javadoc.skip=true -Dgpg.skip -DskipUTs=true clean verify
test-java-with-coverage:
${MVN} --no-transfer-progress -DskipITs=true test jacoco:report-aggregate
build-java:
${MVN} clean verify
build-java-no-tests:
${MVN} --no-transfer-progress -Dmaven.javadoc.skip=true -Dgpg.skip -DskipUTs=true -DskipITs=true -Drevision=${REVISION} clean package
# Trino plugin
start-trino-locally:
cd ${ROOT_DIR}; docker run --detach --rm -p 8080:8080 --name trino -v ${ROOT_DIR}/sdk/python/feast/infra/offline_stores/contrib/trino_offline_store/test_config/properties/:/etc/catalog/:ro trinodb/trino:${TRINO_VERSION}
sleep 15
test-trino-plugin-locally:
cd ${ROOT_DIR}/sdk/python; FULL_REPO_CONFIGS_MODULE=feast.infra.offline_stores.contrib.trino_offline_store.test_config.manual_tests FEAST_USAGE=False IS_TEST=True python -m pytest --integration tests/
kill-trino-locally:
cd ${ROOT_DIR}; docker stop trino
# Go SDK & embedded
install-go-proto-dependencies:
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
install-go-ci-dependencies:
# TODO: currently gopy installation doesn't work w/o explicit go get in the next line
# TODO: there should be a better way to install gopy
go get github.com/go-python/[email protected]
go install golang.org/x/tools/cmd/goimports
# The `go get` command on the previous lines download the lib along with replacing the dep to `feast-dev/gopy`
# but the following command is needed to install it for some reason.
go install github.com/go-python/gopy
python -m pip install pybindgen==0.22.0 protobuf==3.20.1
install-protoc-dependencies:
pip install --ignore-installed protobuf grpcio-tools==1.47.0 mypy-protobuf==3.1.0
compile-protos-go: install-go-proto-dependencies install-protoc-dependencies
python setup.py build_go_protos
compile-go-lib: install-go-proto-dependencies install-go-ci-dependencies
CGO_LDFLAGS_ALLOW=".*" COMPILE_GO=True python setup.py build_ext --inplace
install-feast-ci-locally:
pip install -e ".[ci]"
# Needs feast package to setup the feature store
# CGO flag is due to this issue: https://github.com/golang/go/wiki/InvalidFlag
test-go: compile-protos-go compile-protos-python compile-go-lib install-feast-ci-locally
CGO_LDFLAGS_ALLOW=".*" go test -tags cgo,ccalloc ./...
format-go:
gofmt -s -w go/
lint-go: compile-protos-go compile-go-lib
go vet -tags cgo,ccalloc ./go/internal/feast ./go/embedded
# Docker
build-docker: build-feature-server-python-docker build-feature-server-python-aws-docker build-feature-transformation-server-docker build-feature-server-java-docker
push-ci-docker:
docker push $(REGISTRY)/feast-ci:$(VERSION)
push-feature-server-docker:
docker push $(REGISTRY)/feature-server:$$VERSION
build-feature-server-docker:
docker buildx build --build-arg VERSION=$$VERSION \
-t $(REGISTRY)/feature-server:$$VERSION \
-f sdk/python/feast/infra/feature_servers/multicloud/Dockerfile --load .
push-feature-server-python-aws-docker:
docker push $(REGISTRY)/feature-server-python-aws:$$VERSION
build-feature-server-python-aws-docker:
docker buildx build --build-arg VERSION=$$VERSION \
-t $(REGISTRY)/feature-server-python-aws:$$VERSION \
-f sdk/python/feast/infra/feature_servers/aws_lambda/Dockerfile --load .
push-feature-transformation-server-docker:
docker push $(REGISTRY)/feature-transformation-server:$(VERSION)
build-feature-transformation-server-docker:
docker buildx build --build-arg VERSION=$(VERSION) \
-t $(REGISTRY)/feature-transformation-server:$(VERSION) \
-f sdk/python/feast/infra/transformation_servers/Dockerfile --load .
push-feature-server-java-docker:
docker push $(REGISTRY)/feature-server-java:$(VERSION)
build-feature-server-java-docker:
docker buildx build --build-arg VERSION=$(VERSION) \
-t $(REGISTRY)/feature-server-java:$(VERSION) \
-f java/infra/docker/feature-server/Dockerfile --load .
# Dev images
build-feature-server-dev:
docker buildx build --build-arg VERSION=dev \
-t feastdev/feature-server:dev \
-f sdk/python/feast/infra/feature_servers/multicloud/Dockerfile.dev --load .
build-java-docker-dev:
make build-java-no-tests REVISION=dev
docker buildx build --build-arg VERSION=dev \
-t feastdev/feature-transformation-server:dev \
-f sdk/python/feast/infra/transformation_servers/Dockerfile --load .
docker buildx build --build-arg VERSION=dev \
-t feastdev/feature-server-java:dev \
-f java/infra/docker/feature-server/Dockerfile.dev --load .
# Documentation
install-dependencies-proto-docs:
cd ${ROOT_DIR}/protos;
mkdir -p $$HOME/bin
mkdir -p $$HOME/include
go get github.com/golang/protobuf/proto && \
go get github.com/russross/blackfriday/v2 && \
cd $$(mktemp -d) && \
git clone https://github.com/istio/tools/ && \
cd tools/cmd/protoc-gen-docs && \
go build && \
cp protoc-gen-docs $$HOME/bin && \
cd $$HOME && curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.11.2/protoc-3.11.2-${OS}-x86_64.zip && \
unzip protoc-3.11.2-${OS}-x86_64.zip -d protoc3 && \
mv protoc3/bin/* $$HOME/bin/ && \
chmod +x $$HOME/bin/protoc && \
mv protoc3/include/* $$HOME/include
compile-protos-docs:
rm -rf $(ROOT_DIR)/dist/grpc
mkdir -p dist/grpc;
cd ${ROOT_DIR}/protos && protoc --docs_out=../dist/grpc feast/*/*.proto
build-sphinx: compile-protos-python
cd $(ROOT_DIR)/sdk/python/docs && $(MAKE) build-api-source
build-templates:
python infra/scripts/compile-templates.py
build-helm-docs:
cd ${ROOT_DIR}/infra/charts/feast; helm-docs
cd ${ROOT_DIR}/infra/charts/feast-feature-server; helm-docs
# Web UI
# Note: requires node and yarn to be installed
build-ui:
cd $(ROOT_DIR)/sdk/python/feast/ui && yarn upgrade @feast-dev/feast-ui --latest && yarn install && npm run build --omit=dev