Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
f1fd9b8
Allow specifying FeatureServices in FeatureStore methods
achals Jul 6, 2021
27ea33e
format and lint
achals Jul 6, 2021
7ae1ed3
features_refs -> features
achals Jul 6, 2021
6269200
remote type: ignores
achals Jul 6, 2021
8574163
implement applying and persisting feature services into registry
achals Jul 6, 2021
dbe2995
Fix integration test references
achals Jul 6, 2021
7efd3c3
Add backwards compatibility
achals Jul 6, 2021
3e54197
More lint
achals Jul 6, 2021
3e6cad3
add integration tests
achals Jul 7, 2021
86a528a
refactor and lint
achals Jul 7, 2021
a929aa4
More tests
achals Jul 7, 2021
0368903
Add cli commands
achals Jul 7, 2021
7633674
Update sdk/python/feast/feature_store.py
achals Jul 7, 2021
f48542f
Update sdk/python/feast/feature_store.py
achals Jul 7, 2021
42c6a5f
Update sdk/python/feast/feature_store.py
achals Jul 7, 2021
f612ab3
Update sdk/python/feast/feature_store.py
achals Jul 7, 2021
8fe06c1
Update tests to use file offline source
achals Jul 7, 2021
7248a4c
Make tests integration and lint
achals Jul 7, 2021
09a651d
Retrieve feature services to avoid stale references
achals Jul 7, 2021
8dc58aa
Fix lint
achals Jul 7, 2021
6f09686
Merge changes from master
achals Jul 9, 2021
c656190
Merge master into branch
achals Jul 9, 2021
9540c72
fix tests
achals Jul 9, 2021
4241885
fix import
achals Jul 9, 2021
77ab6c0
fix integ tests
achals Jul 9, 2021
6eac6e8
CR
achals Jul 9, 2021
976293b
format
achals Jul 9, 2021
e1f9a07
Fix integ test
achals Jul 10, 2021
52a6507
Fix integ test
achals Jul 10, 2021
8a91fc1
Merge branch 'master' into achal/feature-service-api
achals Jul 12, 2021
c457f1e
Rename in comments
achals Jul 12, 2021
e3d70a9
Docstrings for Feature Services
achals Jul 12, 2021
545f675
make format
achals Jul 12, 2021
a77eb0f
merge from master
achals Jul 14, 2021
eaa3a89
format and refactor
achals Jul 14, 2021
e3cebc1
docs and updates
achals Jul 14, 2021
8a1534e
Update docs/concepts/feature-service.md
achals Jul 14, 2021
3274a1e
Update sdk/python/feast/feature_service.py
achals Jul 14, 2021
39bf511
Update sdk/python/feast/feature_service.py
achals Jul 14, 2021
2133abc
docs docs docs
achals Jul 14, 2021
f6938c0
docs docs
achals Jul 14, 2021
d495856
merge from master
achals Jul 19, 2021
1317d08
Fixes after merge
achals Jul 19, 2021
ea2210d
Remove dupe
achals Jul 19, 2021
2f0d698
Renames and deletions
achals Jul 19, 2021
ac211d2
lint
achals Jul 19, 2021
23c0d80
format and tests
achals Jul 19, 2021
798df64
remove unused imports
achals Jul 19, 2021
81fb228
fix registry
achals Jul 19, 2021
21aa6b6
fix docs
achals Jul 19, 2021
a6ecc6d
fix dangling print
achals Jul 20, 2021
54c95ae
make format and lint
achals Jul 20, 2021
2394f0a
list feature servces
achals Jul 20, 2021
2d11ab4
Merge branch 'master' into achal/feature-service-api
achals Jul 22, 2021
1ed9592
Merge from master
achals Jul 22, 2021
2a48ae8
fix tests
achals Jul 22, 2021
0943faf
Remove unused file
achals Jul 22, 2021
03d0ba5
single heading
achals Jul 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
format and lint
Signed-off-by: Achal Shah <achals@gmail.com>
  • Loading branch information
achals committed Jul 7, 2021
commit 27ea33e35a1cc5be901d7da8887226880126145c
45 changes: 31 additions & 14 deletions sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@

import pandas as pd
from colorama import Fore, Style
from feast.feature_service import FeatureService
from tqdm import tqdm

from feast import utils
from feast.entity import Entity
from feast.errors import FeastProviderLoginError, FeatureViewNotFoundException
from feast.feature_service import FeatureService
from feast.feature_view import FeatureView
from feast.inference import (
update_data_sources_with_inferred_event_timestamp_col,
Expand Down Expand Up @@ -256,7 +256,9 @@ def apply(

@log_exceptions_and_usage
def get_historical_features(
self, entity_df: Union[pd.DataFrame, str], feature_refs: Union[List[str], List[FeatureService]],
self,
Comment thread
woop marked this conversation as resolved.
Outdated
entity_df: Union[pd.DataFrame, str],
feature_refs: Union[List[str], List[FeatureService]],
) -> RetrievalJob:
"""Enrich an entity dataframe with historical feature values for either training or batch scoring.

Expand Down Expand Up @@ -297,7 +299,9 @@ def get_historical_features(
"""

if not len(feature_refs) > 0:
raise ValueError("A list of feature references or FeatureService must be provided.")
raise ValueError(
"A list of feature references or FeatureService must be provided."
)

all_feature_views = self._registry.list_feature_views(project=self.project)
try:
Expand All @@ -307,15 +311,18 @@ def get_historical_features(
except FeatureViewNotFoundException as e:
sys.exit(e)
Comment thread
achals marked this conversation as resolved.
Outdated

_feature_refs: List[str]
if isinstance(feature_refs[0], FeatureService):
feature_refs = _get_features_refs_from_feature_services(feature_refs)
_feature_refs = _get_features_refs_from_feature_services(feature_refs) # type: ignore
else:
_feature_refs = feature_refs # type: ignore

provider = self._get_provider()
try:
job = provider.get_historical_features(
self.config,
feature_views,
feature_refs,
_feature_refs,
entity_df,
self._registry,
self.project,
Expand Down Expand Up @@ -487,7 +494,9 @@ def tqdm_builder(length):

@log_exceptions_and_usage
def get_online_features(
self, feature_refs: Union[List[str], List[FeatureService]], entity_rows: List[Dict[str, Any]],
self,
feature_refs: Union[List[str], List[FeatureService]],
entity_rows: List[Dict[str, Any]],
) -> OnlineResponse:
"""
Retrieves the latest online feature data.
Expand Down Expand Up @@ -607,7 +616,8 @@ def _entity_row_to_field_values(


def _group_refs(
feature_refs: Union[List[str], FeatureService], all_feature_views: List[FeatureView]
feature_refs: Union[List[str], List[FeatureService]],
all_feature_views: List[FeatureView],
) -> List[Tuple[FeatureView, List[str]]]:
""" Get list of feature views and corresponding feature names based on feature references"""

Expand All @@ -617,23 +627,29 @@ def _group_refs(
# view name to feature names
views_features = defaultdict(list)

if isinstance(feature_refs, list):
if isinstance(feature_refs[0], str):
for ref in feature_refs:
view_name, feat_name = ref.split(":")
view_name, feat_name = ref.split(":") # type: ignore
if view_name not in view_index:
raise FeatureViewNotFoundException(view_name)
views_features[view_name].append(feat_name)
if isinstance(feature_refs, FeatureService):
for feature_projection in feature_refs.features:
views_features[feature_projection.name].extend([f.name for f in feature_projection.features])
elif isinstance(feature_refs[0], FeatureService):
feature_services: List[FeatureService] = feature_refs # type: ignore
for feature_service in feature_services:
for feature_projection in feature_service.features:
views_features[feature_projection.name].extend(
[f.name for f in feature_projection.features]
)

result = []
for view_name, feature_names in views_features.items():
result.append((view_index[view_name], feature_names))
return result


def _get_features_refs_from_feature_services(feature_services: List[FeatureService]) -> List[str]:
def _get_features_refs_from_feature_services(
Comment thread
achals marked this conversation as resolved.
Outdated
feature_services: List[FeatureService],
) -> List[str]:
feature_refs = []
for fs in feature_services:
name = fs.name
Expand All @@ -642,7 +658,8 @@ def _get_features_refs_from_feature_services(feature_services: List[FeatureServi


def _get_requested_feature_views(
feature_refs: Union[List[str], FeatureService], all_feature_views: List[FeatureView]
feature_refs: Union[List[str], List[FeatureService]],
all_feature_views: List[FeatureView],
) -> List[FeatureView]:
"""Get list of feature views based on feature references"""
# TODO: Get rid of this function. We only need _group_refs
Expand Down