forked from feast-dev/feast
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix feature service inference logic (feast-dev#3089)
* Add __init__.py files to allow test files to share names Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Add feature service tests Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix feature service inference logic Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Remove stray `__init__.py` file Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix comments Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Add check Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Temp Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Address comments Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Address comments Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Fix Signed-off-by: Felix Wang <wangfelix98@gmail.com> Signed-off-by: Felix Wang <wangfelix98@gmail.com>
- Loading branch information
1 parent
7e887e4
commit 4310ed7
Showing
22 changed files
with
342 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
63 changes: 63 additions & 0 deletions
63
sdk/python/tests/example_repos/example_feature_repo_with_feature_service_2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
from datetime import timedelta | ||
|
||
from feast import Entity, FeatureService, FeatureView, Field, FileSource | ||
from feast.types import Float32, Int32, Int64 | ||
|
||
driver_hourly_stats = FileSource( | ||
path="data/driver_stats.parquet", # Fake path | ||
timestamp_field="event_timestamp", | ||
created_timestamp_column="created", | ||
) | ||
|
||
driver = Entity( | ||
name="driver_id", | ||
) | ||
|
||
driver_hourly_stats_view = FeatureView( | ||
name="driver_hourly_stats", | ||
entities=[driver], | ||
ttl=timedelta(days=1), | ||
schema=[ | ||
Field(name="conv_rate", dtype=Float32), | ||
Field(name="acc_rate", dtype=Float32), | ||
Field(name="avg_daily_trips", dtype=Int64), | ||
Field(name="driver_id", dtype=Int32), | ||
], | ||
online=True, | ||
source=driver_hourly_stats, | ||
tags={}, | ||
) | ||
|
||
global_daily_stats = FileSource( | ||
path="data/global_stats.parquet", # Fake path | ||
timestamp_field="event_timestamp", | ||
created_timestamp_column="created", | ||
) | ||
|
||
global_stats_feature_view = FeatureView( | ||
name="global_daily_stats", | ||
entities=[], | ||
ttl=timedelta(days=1), | ||
schema=[ | ||
Field(name="num_rides", dtype=Int32), | ||
Field(name="avg_ride_length", dtype=Float32), | ||
], | ||
online=True, | ||
source=global_daily_stats, | ||
tags={}, | ||
) | ||
|
||
all_stats_service = FeatureService( | ||
name="all_stats", | ||
features=[driver_hourly_stats_view, global_stats_feature_view], | ||
tags={"release": "production"}, | ||
) | ||
|
||
some_stats_service = FeatureService( | ||
name="some_stats", | ||
features=[ | ||
driver_hourly_stats_view[["conv_rate"]], | ||
global_stats_feature_view[["num_rides"]], | ||
], | ||
tags={"release": "production"}, | ||
) |
52 changes: 52 additions & 0 deletions
52
sdk/python/tests/example_repos/example_feature_repo_with_feature_service_3.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from datetime import timedelta | ||
|
||
from feast import Entity, FeatureService, FeatureView, FileSource | ||
|
||
driver_hourly_stats = FileSource( | ||
path="%PARQUET_PATH%", # placeholder to be replaced by the test | ||
timestamp_field="event_timestamp", | ||
created_timestamp_column="created", | ||
) | ||
|
||
driver = Entity( | ||
name="driver_id", | ||
) | ||
|
||
driver_hourly_stats_view = FeatureView( | ||
name="driver_hourly_stats", | ||
entities=[driver], | ||
ttl=timedelta(days=1), | ||
online=True, | ||
source=driver_hourly_stats, | ||
tags={}, | ||
) | ||
|
||
global_daily_stats = FileSource( | ||
path="%PARQUET_PATH_GLOBAL%", # placeholder to be replaced by the test | ||
timestamp_field="event_timestamp", | ||
created_timestamp_column="created", | ||
) | ||
|
||
global_stats_feature_view = FeatureView( | ||
name="global_daily_stats", | ||
entities=[], | ||
ttl=timedelta(days=1), | ||
online=True, | ||
source=global_daily_stats, | ||
tags={}, | ||
) | ||
|
||
all_stats_service = FeatureService( | ||
name="all_stats", | ||
features=[driver_hourly_stats_view, global_stats_feature_view], | ||
tags={"release": "production"}, | ||
) | ||
|
||
some_stats_service = FeatureService( | ||
name="some_stats", | ||
features=[ | ||
driver_hourly_stats_view[["conv_rate"]], | ||
global_stats_feature_view[["num_rides"]], | ||
], | ||
tags={"release": "production"}, | ||
) |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.