-
Notifications
You must be signed in to change notification settings - Fork 999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Offline push endpoint for pushing to offline stores #2837
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
c0eec93
Skaffolding for offline store push
kevjumba 110c9b4
LInt
kevjumba 460f1ea
Fix
kevjumba bdcabee
File source offline push
kevjumba c600626
Fix
kevjumba 9456b12
Fix
kevjumba e18bacd
Fix
kevjumba f72dc8c
Fix
kevjumba 8cc2a33
Fix
kevjumba d399f76
Fix
kevjumba c070c1a
Address review comments
kevjumba 1fe4195
Add redshift function
kevjumba 9b43ba3
Add redshift
kevjumba 155a56a
Fix
kevjumba a263365
Lint
kevjumba 3a51046
fix
kevjumba 6de1a3f
fix
kevjumba 1908102
Fix test
kevjumba c3075c4
Fix test
kevjumba 2a4cd10
Fix test
kevjumba 48dfa87
Fix interface
kevjumba 08dad4f
Fix
kevjumba 527ad0d
Fix
kevjumba fdb5e8b
Update
kevjumba 57318fd
Fix
kevjumba ad3f608
Fix
kevjumba 4f7ffd8
Fix rebase
kevjumba 7f4f2a1
Fix naming
kevjumba b48d377
Fix
kevjumba 2e1ddb1
Uncomment
kevjumba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
67 changes: 67 additions & 0 deletions
67
sdk/python/tests/integration/offline_store/test_push_offline_retrieval.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,67 @@ | ||
import datetime | ||
|
||
import numpy as np | ||
import pandas as pd | ||
import pytest | ||
|
||
from feast.data_source import PushMode | ||
from tests.integration.feature_repos.repo_configuration import ( | ||
construct_universal_feature_views, | ||
) | ||
from tests.integration.feature_repos.universal.entities import ( | ||
customer, | ||
driver, | ||
location, | ||
) | ||
|
||
|
||
@pytest.mark.integration | ||
@pytest.mark.universal_offline_stores(only=["file", "redshift"]) | ||
@pytest.mark.universal_online_stores(only=["sqlite"]) | ||
def test_push_features_and_read_from_offline_store(environment, universal_data_sources): | ||
store = environment.feature_store | ||
|
||
(_, _, data_sources) = universal_data_sources | ||
feature_views = construct_universal_feature_views(data_sources) | ||
now = pd.Timestamp(datetime.datetime.utcnow()).round("ms") | ||
|
||
store.apply([driver(), customer(), location(), *feature_views.values()]) | ||
entity_df = pd.DataFrame.from_dict({"location_id": [1], "event_timestamp": [now]}) | ||
|
||
before_df = store.get_historical_features( | ||
entity_df=entity_df, | ||
features=["pushable_location_stats:temperature"], | ||
full_feature_names=False, | ||
).to_df() | ||
|
||
data = { | ||
"event_timestamp": [now], | ||
"location_id": [1], | ||
"temperature": [4], | ||
"created": [now], | ||
} | ||
df_ingest = pd.DataFrame(data) | ||
assert np.where( | ||
before_df["location_id"].reset_index(drop=True) | ||
== df_ingest["location_id"].reset_index(drop=True) | ||
) | ||
assert np.where( | ||
before_df["temperature"].reset_index(drop=True) | ||
!= df_ingest["temperature"].reset_index(drop=True) | ||
) | ||
|
||
store.push("location_stats_push_source", df_ingest, to=PushMode.OFFLINE) | ||
|
||
df = store.get_historical_features( | ||
entity_df=entity_df, | ||
features=["pushable_location_stats:temperature"], | ||
full_feature_names=False, | ||
).to_df() | ||
assert np.where( | ||
df["location_id"].reset_index(drop=True) | ||
== df_ingest["location_id"].reset_index(drop=True) | ||
) | ||
assert np.where( | ||
df["temperature"].reset_index(drop=True) | ||
== df_ingest["temperature"].reset_index(drop=True) | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that if someone types
"Online"
this will default toPushMode.ONLINE_AND_OFFLINE
. Should this be explicit instead? e.g.online_and_offline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed. cc @kevjumba @felixwang9817
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup adding a fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I was wondering and I thought I had fixed this issue already, the fix is already in master.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes. It was fixed at master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for wasting your time on this one! Should've checked first! 🤦