Search…
[Alpha] Local feature server
Warning: This is an experimental feature. It's intended for early testing and feedback, and could change without warnings in future releases.
To enable this feature, run feast alpha enable python_feature_server

Overview

The local feature server is an HTTP endpoint that serves features with JSON I/O. This enables users to get features from Feast using any programming language that can make HTTP requests. A remote feature server on AWS Lambda is also available. A remote feature server on GCP Cloud Run is currently being developed.

CLI

There is a new CLI command that starts the server: feast serve. By default Feast uses port 6566; the port be overridden by a --port flag.

Example

Here's the local feature server usage example with the local template:
1
$ feast init feature_repo
2
Creating a new Feast repository in /home/tsotne/feast/feature_repo.
3
4
$ cd feature_repo
5
6
$ feast apply
7
Registered entity driver_id
8
Registered feature view driver_hourly_stats
9
Deploying infrastructure for driver_hourly_stats
10
11
$ feast materialize-incremental $(date +%Y-%m-%d)
12
Materializing 1 feature views to 2021-09-09 17:00:00-07:00 into the sqlite online store.
13
14
driver_hourly_stats from 2021-09-09 16:51:08-07:00 to 2021-09-09 17:00:00-07:00:
15
100%|████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 295.24it/s]
16
17
$ feast serve
18
This is an experimental feature. It's intended for early testing and feedback, and could change without warnings in future releases.
19
INFO: Started server process [8889]
20
09/10/2021 10:42:11 AM INFO:Started server process [8889]
21
INFO: Waiting for application startup.
22
09/10/2021 10:42:11 AM INFO:Waiting for application startup.
23
INFO: Application startup complete.
24
09/10/2021 10:42:11 AM INFO:Application startup complete.
25
INFO: Uvicorn running on http://127.0.0.1:6566 (Press CTRL+C to quit)
26
09/10/2021 10:42:11 AM INFO:Uvicorn running on http://127.0.0.1:6566 (Press CTRL+C to quit)
Copied!
After the server starts, we can execute cURL commands from another terminal tab:
1
$ curl -X POST \
2
"http://localhost:6566/get-online-features" \
3
-d '{
4
"features": [
5
"driver_hourly_stats:conv_rate",
6
"driver_hourly_stats:acc_rate",
7
"driver_hourly_stats:avg_daily_trips"
8
],
9
"entities": {
10
"driver_id": [1001, 1002, 1003]
11
}
12
}' | jq
13
{
14
"field_values": [
15
{
16
"fields": {
17
"driver_id": 1001,
18
"conv_rate": 0.07427442818880081,
19
"avg_daily_trips": 140,
20
"acc_rate": 0.8625795245170593
21
},
22
"statuses": {
23
"conv_rate": "PRESENT",
24
"acc_rate": "PRESENT",
25
"driver_id": "PRESENT",
26
"avg_daily_trips": "PRESENT"
27
}
28
},
29
{
30
"fields": {
31
"avg_daily_trips": 646,
32
"acc_rate": 0.8026317954063416,
33
"conv_rate": 0.41487279534339905,
34
"driver_id": 1002
35
},
36
"statuses": {
37
"driver_id": "PRESENT",
38
"avg_daily_trips": "PRESENT",
39
"conv_rate": "PRESENT",
40
"acc_rate": "PRESENT"
41
}
42
},
43
{
44
"fields": {
45
"avg_daily_trips": 671,
46
"conv_rate": 0.4033895432949066,
47
"driver_id": 1003,
48
"acc_rate": 0.06059994176030159
49
},
50
"statuses": {
51
"driver_id": "PRESENT",
52
"conv_rate": "PRESENT",
53
"avg_daily_trips": "PRESENT",
54
"acc_rate": "PRESENT"
55
}
56
}
57
]
58
}
Copied!
It's also possible to specify a feature service name instead of the list of features:
1
curl -X POST \
2
"http://localhost:6566/get-online-features" \
3
-d '{
4
"feature_service": <feature-service-name>,
5
"entities": {
6
"driver_id": [1001, 1002, 1003]
7
}
8
}' | jq
Copied!
Last modified 5d ago
Export as PDF
Copy link