Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_large_volume_retrieve_online_success(client, large_volume_dataframe):
# Poll serving for feature values until the correct values are returned
while True:
time.sleep(1)
response = client.get_online_features(
entity_rows=[
GetOnlineFeaturesRequest.EntityRow(
fields={
"customer_id": Value(
int64_val=large_volume_dataframe.iloc[0][
"customer_id"]
)
}
)
],
feature_refs=[
"daily_transactions_large",
"total_transactions_large",
],
) # type: GetOnlineFeaturesResponse
if response is None:
continue
def test_basic_retrieve_online_success(client, basic_dataframe):
# Poll serving for feature values until the correct values are returned
while True:
time.sleep(1)
client.set_project(PROJECT_NAME)
response = client.get_online_features(
entity_rows=[
GetOnlineFeaturesRequest.EntityRow(
fields={
"customer_id": Value(
int64_val=basic_dataframe.iloc[0]["customer_id"]
)
}
)
],
feature_refs=[
"daily_transactions",
"total_transactions",
],
) # type: GetOnlineFeaturesResponse
if response is None:
continue
["my_project/my_feature_1:3",
"my_project3/my_feature_4:1",]
entity_rows: List of GetFeaturesRequest.EntityRow where each row
contains entities. Timestamp should not be set for online
retrieval. All entity types within a feature
default_project: This project will be used if the project name is
not provided in the feature reference
Returns:
Returns a list of maps where each item in the list contains the
latest feature values for the provided entities
"""
self._connect_serving()
return self._serving_service_stub.GetOnlineFeatures(
GetOnlineFeaturesRequest(
features=_build_feature_references(
feature_refs=feature_refs,
default_project=(
default_project if not self.project else self.project
),
),
entity_rows=entity_rows,
)
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.GetFeastServingInfo = channel.unary_unary(
'/feast.serving.ServingService/GetFeastServingInfo',
request_serializer=feast_dot_serving_dot_ServingService__pb2.GetFeastServingInfoRequest.SerializeToString,
response_deserializer=feast_dot_serving_dot_ServingService__pb2.GetFeastServingInfoResponse.FromString,
)
self.GetOnlineFeatures = channel.unary_unary(
'/feast.serving.ServingService/GetOnlineFeatures',
request_serializer=feast_dot_serving_dot_ServingService__pb2.GetOnlineFeaturesRequest.SerializeToString,
response_deserializer=feast_dot_serving_dot_ServingService__pb2.GetOnlineFeaturesResponse.FromString,
)
self.GetBatchFeatures = channel.unary_unary(
'/feast.serving.ServingService/GetBatchFeatures',
request_serializer=feast_dot_serving_dot_ServingService__pb2.GetBatchFeaturesRequest.SerializeToString,
response_deserializer=feast_dot_serving_dot_ServingService__pb2.GetBatchFeaturesResponse.FromString,
)
self.GetJob = channel.unary_unary(
'/feast.serving.ServingService/GetJob',
request_serializer=feast_dot_serving_dot_ServingService__pb2.GetJobRequest.SerializeToString,
response_deserializer=feast_dot_serving_dot_ServingService__pb2.GetJobResponse.FromString,
)
def add_ServingServiceServicer_to_server(servicer, server):
rpc_method_handlers = {
'GetFeastServingInfo': grpc.unary_unary_rpc_method_handler(
servicer.GetFeastServingInfo,
request_deserializer=feast_dot_serving_dot_ServingService__pb2.GetFeastServingInfoRequest.FromString,
response_serializer=feast_dot_serving_dot_ServingService__pb2.GetFeastServingInfoResponse.SerializeToString,
),
'GetOnlineFeatures': grpc.unary_unary_rpc_method_handler(
servicer.GetOnlineFeatures,
request_deserializer=feast_dot_serving_dot_ServingService__pb2.GetOnlineFeaturesRequest.FromString,
response_serializer=feast_dot_serving_dot_ServingService__pb2.GetOnlineFeaturesResponse.SerializeToString,
),
'GetBatchFeatures': grpc.unary_unary_rpc_method_handler(
servicer.GetBatchFeatures,
request_deserializer=feast_dot_serving_dot_ServingService__pb2.GetBatchFeaturesRequest.FromString,
response_serializer=feast_dot_serving_dot_ServingService__pb2.GetBatchFeaturesResponse.SerializeToString,
),
'GetJob': grpc.unary_unary_rpc_method_handler(
servicer.GetJob,
request_deserializer=feast_dot_serving_dot_ServingService__pb2.GetJobRequest.FromString,
response_serializer=feast_dot_serving_dot_ServingService__pb2.GetJobResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'feast.serving.ServingService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))