Skip to content

Commit e4f2756

Browse files
Chen Zhilingfeast-ci-bot
authored andcommitted
Batch retrieval tests (#357)
* Add batch end-to-end test * Fix issues in the batch tests
1 parent 306b146 commit e4f2756

2 files changed

Lines changed: 261 additions & 0 deletions

File tree

.prow/config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,27 @@ presubmits:
110110
limit:
111111
memory: "4096Mi"
112112

113+
- name: test-end-to-end-batch
114+
decorate: true
115+
always_run: true
116+
spec:
117+
volumes:
118+
- name: service-account
119+
secret:
120+
secretName: feast-service-account
121+
containers:
122+
- image: maven:3.6-jdk-8
123+
command: [".prow/scripts/test-end-to-end-batch.sh"]
124+
resources:
125+
requests:
126+
cpu: "1000m"
127+
memory: "1024Mi"
128+
limit:
129+
memory: "4096Mi"
130+
volumeMounts:
131+
- name: service-account
132+
mountPath: "/etc/service-account"
133+
113134
# TODO: do a release when a git tag is pushed
114135
#
115136
# postsubmits list Prow jobs that run on every push
Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -o pipefail
5+
6+
if ! cat /etc/*release | grep -q stretch; then
7+
echo ${BASH_SOURCE} only supports Debian stretch.
8+
echo Please change your operating system to use this script.
9+
exit 1
10+
fi
11+
12+
echo "
13+
This script will run end-to-end tests for Feast Core and Batch Serving.
14+
15+
1. Install gcloud SDK
16+
2. Install Redis as the job store for Feast Batch Serving.
17+
4. Install Postgres for persisting Feast metadata.
18+
5. Install Kafka and Zookeeper as the Source in Feast.
19+
6. Install Python 3.7.4, Feast Python SDK and run end-to-end tests from
20+
tests/e2e via pytest.
21+
"
22+
23+
24+
echo "
25+
============================================================
26+
Installing gcloud SDK
27+
============================================================
28+
"
29+
if [[ ! $(command -v gsutil) ]]; then
30+
CURRENT_DIR=$(dirname "$BASH_SOURCE")
31+
. "${CURRENT_DIR}"/install_google_cloud_sdk.sh
32+
fi
33+
34+
export GOOGLE_APPLICATION_CREDENTIALS=/etc/service-account/service-account.json
35+
gcloud auth activate-service-account --key-file /etc/service-account/service-account.json
36+
37+
38+
39+
echo "
40+
============================================================
41+
Installing Redis at localhost:6379
42+
============================================================
43+
"
44+
apt-get -qq update
45+
# Allow starting serving in this Maven Docker image. Default set to not allowed.
46+
echo "exit 0" > /usr/sbin/policy-rc.d
47+
apt-get -y install redis-server wget > /var/log/redis.install.log
48+
redis-server --daemonize yes
49+
redis-cli ping
50+
51+
echo "
52+
============================================================
53+
Installing Postgres at localhost:5432
54+
============================================================
55+
"
56+
apt-get -y install postgresql > /var/log/postgresql.install.log
57+
service postgresql start
58+
# Initialize with database: 'postgres', user: 'postgres', password: 'password'
59+
cat <<EOF > /tmp/update-postgres-role.sh
60+
psql -c "ALTER USER postgres PASSWORD 'password';"
61+
EOF
62+
chmod +x /tmp/update-postgres-role.sh
63+
su -s /bin/bash -c /tmp/update-postgres-role.sh postgres
64+
export PGPASSWORD=password
65+
pg_isready
66+
67+
echo "
68+
============================================================
69+
Installing Zookeeper at localhost:2181
70+
Installing Kafka at localhost:9092
71+
============================================================
72+
"
73+
wget -qO- https://www-eu.apache.org/dist/kafka/2.3.0/kafka_2.12-2.3.0.tgz | tar xz
74+
mv kafka_2.12-2.3.0/ /tmp/kafka
75+
nohup /tmp/kafka/bin/zookeeper-server-start.sh /tmp/kafka/config/zookeeper.properties &> /var/log/zookeeper.log 2>&1 &
76+
sleep 5
77+
tail -n10 /var/log/zookeeper.log
78+
nohup /tmp/kafka/bin/kafka-server-start.sh /tmp/kafka/config/server.properties &> /var/log/kafka.log 2>&1 &
79+
sleep 10
80+
tail -n10 /var/log/kafka.log
81+
82+
echo "
83+
============================================================
84+
Building jars for Feast
85+
============================================================
86+
"
87+
88+
.prow/scripts/download-maven-cache.sh \
89+
--archive-uri gs://feast-templocation-kf-feast/.m2.2019-10-24.tar \
90+
--output-dir /root/
91+
92+
# Build jars for Feast
93+
mvn --quiet --batch-mode --define skipTests=true clean package
94+
95+
echo "
96+
============================================================
97+
Starting Feast Core
98+
============================================================
99+
"
100+
# Start Feast Core in background
101+
cat <<EOF > /tmp/core.application.yml
102+
grpc:
103+
port: 6565
104+
enable-reflection: true
105+
106+
feast:
107+
version: 0.3
108+
jobs:
109+
runner: DirectRunner
110+
options: {}
111+
metrics:
112+
enabled: false
113+
114+
stream:
115+
type: kafka
116+
options:
117+
topic: feast-features
118+
bootstrapServers: localhost:9092
119+
replicationFactor: 1
120+
partitions: 1
121+
122+
spring:
123+
jpa:
124+
properties.hibernate.format_sql: true
125+
hibernate.naming.physical-strategy=org.hibernate.boot.model.naming: PhysicalNamingStrategyStandardImpl
126+
hibernate.ddl-auto: update
127+
datasource:
128+
url: jdbc:postgresql://localhost:5432/postgres
129+
username: postgres
130+
password: password
131+
132+
management:
133+
metrics:
134+
export:
135+
simple:
136+
enabled: false
137+
statsd:
138+
enabled: false
139+
EOF
140+
141+
nohup java -jar core/target/feast-core-0.3.2-SNAPSHOT.jar \
142+
--spring.config.location=file:///tmp/core.application.yml \
143+
&> /var/log/feast-core.log &
144+
sleep 30
145+
tail -n10 /var/log/feast-core.log
146+
echo "
147+
============================================================
148+
Starting Feast Warehouse Serving
149+
============================================================
150+
"
151+
152+
DATASET_NAME=feast_$(date +%s)
153+
154+
bq --location=US --project_id=kf-feast mk \
155+
--dataset \
156+
--default_table_expiration 86400 \
157+
kf-feast:$DATASET_NAME
158+
159+
# Start Feast Online Serving in background
160+
cat <<EOF > /tmp/serving.store.bigquery.yml
161+
name: warehouse
162+
type: BIGQUERY
163+
bigquery_config:
164+
projectId: kf-feast
165+
datasetId: $DATASET_NAME
166+
subscriptions:
167+
- name: "*"
168+
version: ">0"
169+
EOF
170+
171+
cat <<EOF > /tmp/serving.warehouse.application.yml
172+
feast:
173+
version: 0.3
174+
core-host: localhost
175+
core-grpc-port: 6565
176+
tracing:
177+
enabled: false
178+
store:
179+
config-path: /tmp/serving.store.bigquery.yml
180+
jobs:
181+
staging-location: gs://feast-templocation-kf-feast/staging-location
182+
store-type: REDIS
183+
store-options:
184+
host: $REMOTE_HOST
185+
port: 6379
186+
grpc:
187+
port: 6566
188+
enable-reflection: true
189+
spring:
190+
main:
191+
web-environment: false
192+
EOF
193+
194+
nohup java -jar serving/target/feast-serving-0.3.2-SNAPSHOT.jar \
195+
--spring.config.location=file:///tmp/serving.warehouse.application.yml \
196+
&> /var/log/feast-serving-warehouse.log &
197+
sleep 15
198+
tail -n100 /var/log/feast-serving-warehouse.log
199+
200+
echo "
201+
============================================================
202+
Installing Python 3.7 with Miniconda and Feast SDK
203+
============================================================
204+
"
205+
# Install Python 3.7 with Miniconda
206+
wget -q https://repo.continuum.io/miniconda/Miniconda3-4.7.12-Linux-x86_64.sh \
207+
-O /tmp/miniconda.sh
208+
bash /tmp/miniconda.sh -b -p /root/miniconda -f
209+
/root/miniconda/bin/conda init
210+
source ~/.bashrc
211+
212+
# Install Feast Python SDK and test requirements
213+
pip install -q sdk/python
214+
pip install -qr tests/e2e/requirements.txt
215+
216+
echo "
217+
============================================================
218+
Running end-to-end tests with pytest at 'tests/e2e'
219+
============================================================
220+
"
221+
# Default artifact location setting in Prow jobs
222+
LOGS_ARTIFACT_PATH=/logs/artifacts
223+
224+
ORIGINAL_DIR=$(pwd)
225+
cd tests/e2e
226+
227+
set +e
228+
pytest bq-batch-retrieval.py --junitxml=${LOGS_ARTIFACT_PATH}/python-sdk-test-report.xml
229+
TEST_EXIT_CODE=$?
230+
231+
cd ${ORIGINAL_DIR}
232+
exit ${TEST_EXIT_CODE}
233+
234+
echo "
235+
============================================================
236+
Cleaning up
237+
============================================================
238+
"
239+
240+
bq rm -r -f kf-feast:$DATASET_NAME

0 commit comments

Comments
 (0)