Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add possibility to define feature_store.yaml path with environment va…
…riable for aws and lambda_engine

Signed-off-by: arcabucero <arcabucero@gmail.com>
  • Loading branch information
arcabucero committed Sep 24, 2022
commit f6515dd8a4f37fa3d6f36df45152bf84da77407f
3 changes: 3 additions & 0 deletions sdk/python/feast/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
# feature_store.yaml environment variable name for remote feature server
FEATURE_STORE_YAML_ENV_NAME: str = "FEATURE_STORE_YAML_BASE64"

# feature_store.yaml path environment variable name
FEAST_FS_YAML_FILE_PATH_ENV_NAME: str = "FEAST_FS_YAML_FILE_PATH"

# Environment variable for registry
REGISTRY_ENV_NAME: str = "REGISTRY_BASE64"

Expand Down
6 changes: 5 additions & 1 deletion sdk/python/feast/infra/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from colorama import Fore, Style

from feast import utils
from feast.constants import (
AWS_LAMBDA_FEATURE_SERVER_IMAGE,
AWS_LAMBDA_FEATURE_SERVER_REPOSITORY,
Expand Down Expand Up @@ -113,7 +114,10 @@ def _deploy_feature_server(self, project: str, image_uri: str):

if not self.repo_config.repo_path:
raise RepoConfigPathDoesNotExist()
with open(self.repo_config.repo_path / "feature_store.yaml", "rb") as f:

with open(
utils.get_default_yaml_file_path(self.repo_config.repo_path), "rb"
) as f:
config_bytes = f.read()
config_base64 = base64.b64encode(config_bytes).decode()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pydantic import StrictStr
from tqdm import tqdm

from feast import utils
from feast.batch_feature_view import BatchFeatureView
from feast.constants import FEATURE_STORE_YAML_ENV_NAME
from feast.entity import Entity
Expand Down Expand Up @@ -137,7 +138,7 @@ def __init__(
)
repo_path = self.repo_config.repo_path
assert repo_path
feature_store_path = repo_path / "feature_store.yaml"
feature_store_path = utils.get_default_yaml_file_path(repo_path)
self.feature_store_base64 = str(
base64.b64encode(bytes(feature_store_path.read_text(), "UTF-8")), "UTF-8"
)
Expand Down
7 changes: 4 additions & 3 deletions sdk/python/feast/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from dateutil.tz import tzlocal
from pytz import utc

from feast.constants import FEAST_FS_YAML_FILE_PATH_ENV_NAME
from feast.entity import Entity
from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
from feast.protos.feast.types.Value_pb2 import Value as ValueProto
Expand Down Expand Up @@ -54,9 +55,9 @@ def maybe_local_tz(t: datetime) -> datetime:


def get_default_yaml_file_path(repo_path: Path) -> Path:
if "FEAST_FS_YAML_FILE_PATH" in os.environ:
yaml_path = os.environ["FEAST_FS_YAML_FILE_PATH"]
return Path(yaml_path) / "feature_store.yaml"
if FEAST_FS_YAML_FILE_PATH_ENV_NAME in os.environ:
yaml_path = os.environ[FEAST_FS_YAML_FILE_PATH_ENV_NAME]
return Path(yaml_path)
else:
return repo_path / "feature_store.yaml"

Expand Down