Skip to content

Commit d0778f7

Browse files
Make serverless alpha feature (#1928)
* Hide AWS Lambda feature server behind experimental flag Signed-off-by: Felix Wang <wangfelix98@gmail.com> * Ensure that registry is on S3 for AWS Lambda feature server Signed-off-by: Felix Wang <wangfelix98@gmail.com>
1 parent a0918bf commit d0778f7

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

sdk/python/feast/errors.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,3 +294,10 @@ def __init__(self, resource_name: str):
294294
super().__init__(
295295
f"The AWS API Gateway {resource_name} should have been created properly, but does not exist."
296296
)
297+
298+
299+
class IncompatibleRegistryStoreClass(Exception):
300+
def __init__(self, actual_class: str, expected_class: str):
301+
super().__init__(
302+
f"The registry store class was expected to be {expected_class}, but was instead {actual_class}."
303+
)

sdk/python/feast/flags.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
FLAG_ALPHA_FEATURES_NAME = "alpha_features"
22
FLAG_ON_DEMAND_TRANSFORM_NAME = "on_demand_transforms"
33
FLAG_PYTHON_FEATURE_SERVER_NAME = "python_feature_server"
4+
FLAG_AWS_LAMBDA_FEATURE_SERVER_NAME = "aws_lambda_feature_server"
45
ENV_FLAG_IS_TEST = "IS_TEST"
56

67
FLAG_NAMES = {
78
FLAG_ALPHA_FEATURES_NAME,
89
FLAG_ON_DEMAND_TRANSFORM_NAME,
910
FLAG_PYTHON_FEATURE_SERVER_NAME,
11+
FLAG_AWS_LAMBDA_FEATURE_SERVER_NAME,
1012
}

sdk/python/feast/flags_helper.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ def enable_on_demand_feature_views(repo_config: RepoConfig) -> bool:
3737

3838
def enable_python_feature_server(repo_config: RepoConfig) -> bool:
3939
return feature_flag_enabled(repo_config, flags.FLAG_PYTHON_FEATURE_SERVER_NAME)
40+
41+
42+
def enable_aws_lambda_feature_server(repo_config: RepoConfig) -> bool:
43+
return feature_flag_enabled(repo_config, flags.FLAG_AWS_LAMBDA_FEATURE_SERVER_NAME)

sdk/python/feast/infra/aws.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,20 @@
1919
from feast.errors import (
2020
AwsAPIGatewayDoesNotExist,
2121
AwsLambdaDoesNotExist,
22+
ExperimentalFeatureNotEnabled,
23+
IncompatibleRegistryStoreClass,
2224
RepoConfigPathDoesNotExist,
2325
S3RegistryBucketForbiddenAccess,
2426
S3RegistryBucketNotExist,
2527
)
2628
from feast.feature_table import FeatureTable
2729
from feast.feature_view import FeatureView
30+
from feast.flags import FLAG_AWS_LAMBDA_FEATURE_SERVER_NAME
31+
from feast.flags_helper import enable_aws_lambda_feature_server
2832
from feast.infra.passthrough_provider import PassthroughProvider
2933
from feast.infra.utils import aws_utils
3034
from feast.protos.feast.core.Registry_pb2 import Registry as RegistryProto
35+
from feast.registry import get_registry_store_class_from_scheme
3136
from feast.registry_store import RegistryStore
3237
from feast.repo_config import RegistryConfig
3338
from feast.version import get_version
@@ -62,6 +67,22 @@ def update_infra(
6267
)
6368

6469
if self.repo_config.feature_server and self.repo_config.feature_server.enabled:
70+
if not enable_aws_lambda_feature_server(self.repo_config):
71+
raise ExperimentalFeatureNotEnabled(FLAG_AWS_LAMBDA_FEATURE_SERVER_NAME)
72+
73+
# Since the AWS Lambda feature server will attempt to load the registry, we
74+
# only allow the registry to be in S3.
75+
registry_path = (
76+
self.repo_config.registry
77+
if isinstance(self.repo_config.registry, str)
78+
else self.repo_config.registry.path
79+
)
80+
registry_store_class = get_registry_store_class_from_scheme(registry_path)
81+
if registry_store_class != S3RegistryStore:
82+
raise IncompatibleRegistryStoreClass(
83+
registry_store_class.__name__, S3RegistryStore.__name__
84+
)
85+
6586
image_uri = self._upload_docker_image(project)
6687
_logger.info("Deploying feature server...")
6788

0 commit comments

Comments
 (0)