Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
- bash
- -c
- |
pip install -U feast==0.4.*
pip install -U feast==0.7.*

cat <<EOF > featureset.yaml
kind: feature_set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
- bash
- -c
- |
pip install -U feast==0.4.*
pip install -U feast==0.7.*

cat <<EOF > featureset.yaml
kind: feature_set
Expand Down Expand Up @@ -68,12 +68,9 @@ spec:
time.sleep(5)

entity_rows=[
GetOnlineFeaturesRequest.EntityRow(
fields={"customer_id": Value(int64_val=0)}),
GetOnlineFeaturesRequest.EntityRow(
fields={"customer_id": Value(int64_val=1)}),
GetOnlineFeaturesRequest.EntityRow(
fields={"customer_id": Value(int64_val=2)}),
{"customer_id": Value(int64_val=0)},
{"customer_id": Value(int64_val=1)},
{"customer_id": Value(int64_val=2)},
]

result_df = client.get_online_features(
Expand Down
38 changes: 2 additions & 36 deletions sdk/python/feast/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import tempfile
import time
import uuid
import warnings
from collections import OrderedDict
from math import ceil
from typing import Any, Dict, List, Optional, Tuple, Union, cast
Expand Down Expand Up @@ -91,8 +90,6 @@

CPU_COUNT: int = multiprocessing.cpu_count()

warnings.simplefilter("once", DeprecationWarning)


class Client:
"""
Expand Down Expand Up @@ -543,25 +540,6 @@ def list_entities(self) -> Dict[str, Entity]:
entities_dict[entity.name] = entity
return entities_dict

def get_batch_features(
self,
feature_refs: List[str],
entity_rows: Union[pd.DataFrame, str],
compute_statistics: bool = False,
project: str = None,
) -> RetrievalJob:
"""
Deprecated. Please see get_historical_features.
"""
warnings.warn(
"The method get_batch_features() is being deprecated. Please use the identical get_historical_features(). "
"Feast 0.7 and onwards will not support get_batch_features().",
DeprecationWarning,
)
return self.get_historical_features(
feature_refs, entity_rows, compute_statistics, project
)

def get_historical_features(
self,
feature_refs: List[str],
Expand Down Expand Up @@ -683,7 +661,7 @@ def get_historical_features(
def get_online_features(
self,
feature_refs: List[str],
entity_rows: List[Union[GetOnlineFeaturesRequest.EntityRow, Dict[str, Any]]],
entity_rows: List[Dict[str, Any]],
project: Optional[str] = None,
omit_entities: bool = False,
) -> OnlineResponse:
Expand Down Expand Up @@ -964,7 +942,7 @@ def _get_grpc_metadata(self):


def _infer_online_entity_rows(
entity_rows: List[Union[GetOnlineFeaturesRequest.EntityRow, Dict[str, Any]]],
entity_rows: List[Dict[str, Any]],
) -> List[GetOnlineFeaturesRequest.EntityRow]:
"""
Builds a list of EntityRow protos from Python native type format passed by user.
Expand All @@ -976,18 +954,6 @@ def _infer_online_entity_rows(
Returns:
A list of EntityRow protos parsed from args.
"""

# Maintain backward compatibility with users providing EntityRow Proto
if entity_rows and isinstance(entity_rows[0], GetOnlineFeaturesRequest.EntityRow):
warnings.warn(
"entity_rows parameter will only be accepting Dict format from Feast v0.7 onwards",
DeprecationWarning,
)
entity_rows_proto = cast(
List[Union[GetOnlineFeaturesRequest.EntityRow]], entity_rows
)
return entity_rows_proto

entity_rows_dicts = cast(List[Dict[str, Any]], entity_rows)
entity_row_list = []
entity_type_map = dict()
Expand Down
6 changes: 4 additions & 2 deletions sdk/python/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,14 @@ def int_val(x):
]
)
recieve_response = GetOnlineFeaturesResponse()
entity_rows = []
for row_number in range(1, ROW_COUNT + 1):
request.entity_rows.append(
GetOnlineFeaturesRequest.EntityRow(
fields={"driver_id": int_val(row_number)}
)
),
)
entity_rows.append({"driver_id": int_val(row_number)})
field_values = GetOnlineFeaturesResponse.FieldValues(
fields={
"driver_id": int_val(row_number),
Expand All @@ -370,7 +372,7 @@ def int_val(x):
return_value=recieve_response,
)
got_response = mocked_client.get_online_features(
entity_rows=request.entity_rows,
entity_rows=entity_rows,
feature_refs=["driver:age", "rating", "null_value"],
project="driver_project",
) # type: GetOnlineFeaturesResponse
Expand Down
53 changes: 15 additions & 38 deletions tests/e2e/redis/basic-ingest-redis-serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
from feast.feature import Feature
from feast.feature_set import FeatureSet, FeatureSetRef
from feast.grpc.auth import get_auth_metadata_plugin
from feast.serving.ServingService_pb2 import (
GetOnlineFeaturesRequest,
GetOnlineFeaturesResponse,
)
from feast.serving.ServingService_pb2 import GetOnlineFeaturesResponse
from feast.source import KafkaSource
from feast.type_map import ValueType
from feast.types.Value_pb2 import Int64List
Expand Down Expand Up @@ -264,13 +261,7 @@ def test_basic_retrieve_online_success(client, cust_trans_df):
def try_get_features():
response = client.get_online_features(
entity_rows=[
GetOnlineFeaturesRequest.EntityRow(
fields={
"customer_id": Value(
int64_val=cust_trans_df.iloc[0]["customer_id"]
)
}
)
{"customer_id": Value(int64_val=cust_trans_df.iloc[0]["customer_id"])}
],
feature_refs=feature_refs,
) # type: GetOnlineFeaturesResponse
Expand Down Expand Up @@ -305,14 +296,12 @@ def try_get_features():
feature_refs = [mapping[0] for mapping in feature_ref_df_mapping]
response = client.get_online_features(
entity_rows=[
GetOnlineFeaturesRequest.EntityRow(
fields={
"customer_id": Value(
int64_val=cust_trans_df.iloc[0]["customer_id"]
),
"driver_id": Value(int64_val=driver_df.iloc[0]["driver_id"]),
}
)
{
"customer_id": Value(
int64_val=cust_trans_df.iloc[0]["customer_id"]
),
"driver_id": Value(int64_val=driver_df.iloc[0]["driver_id"]),
}
],
feature_refs=feature_refs,
) # type: GetOnlineFeaturesResponse
Expand Down Expand Up @@ -986,13 +975,7 @@ def test_all_types_retrieve_online_success(client, all_types_dataframe):
def try_get_features():
response = client.get_online_features(
entity_rows=[
GetOnlineFeaturesRequest.EntityRow(
fields={
"user_id": Value(
int64_val=all_types_dataframe.iloc[0]["user_id"]
)
}
)
{"user_id": Value(int64_val=all_types_dataframe.iloc[0]["user_id"])}
],
feature_refs=feature_refs,
) # type: GetOnlineFeaturesResponse
Expand Down Expand Up @@ -1134,13 +1117,11 @@ def test_large_volume_retrieve_online_success(client, large_volume_dataframe):
while True:
response = client.get_online_features(
entity_rows=[
GetOnlineFeaturesRequest.EntityRow(
fields={
"customer_id": Value(
int64_val=large_volume_dataframe.iloc[0]["customer_id"]
)
}
)
{
"customer_id": Value(
int64_val=large_volume_dataframe.iloc[0]["customer_id"]
)
}
],
feature_refs=feature_refs,
) # type: GetOnlineFeaturesResponse
Expand Down Expand Up @@ -1432,11 +1413,7 @@ def test_sink_writes_only_recent_rows(client):

def try_get_features():
response = client.get_online_features(
entity_rows=[
GetOnlineFeaturesRequest.EntityRow(
fields={"driver_id": Value(int64_val=later_df.iloc[0]["driver_id"])}
)
],
entity_rows=[{"driver_id": Value(int64_val=later_df.iloc[0]["driver_id"])}],
feature_refs=feature_refs,
) # type: GetOnlineFeaturesResponse
is_ok = all(
Expand Down