FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: Force absolute paths in file based registries by boliri · Pull Request #4774 · feast-dev/feast · GitHub

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (3) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 8 additions & 0 deletions sdk/python/feast/errors.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,14 @@ def __init__(self, registry_type: str):
)


class FeastFileRegistryPathNotAbsoluteError(FeastError):
def __init__(self, path: str):
super().__init__(
f"File registry path was set to {path}, which is a relative path. "
"Please, specify the absolute path of the registry file in the feature_store.yaml"
)


class FeastModuleImportError(FeastError):
def __init__(self, module_name: str, class_name: str):
super().__init__(
Expand Down
10 changes: 10 additions & 0 deletions sdk/python/feast/repo_config.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from feast.errors import (
FeastFeatureServerTypeInvalidError,
FeastFileRegistryPathNotAbsoluteError,
FeastInvalidAuthConfigClass,
FeastOfflineStoreInvalidName,
FeastOnlineStoreInvalidName,
Expand Down Expand Up @@ -166,6 +167,15 @@ def validate_path(cls, path: str, values: ValidationInfo) -> str:
"explicitely to `path`."
)
return path.replace("postgresql://", "postgresql+psycopg://")

if values.data.get("registry_type") == "file":
is_local_file_registry = not (
path.startswith("s3://") or path.startswith("gs://")
)
is_relative_path = not os.path.isabs(path)
if is_local_file_registry and is_relative_path:
raise FeastFileRegistryPathNotAbsoluteError(str(path))

return path


Expand Down
19 changes: 18 additions & 1 deletion sdk/python/feast/repo_operations.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -486,11 +486,28 @@ def init_repo(repo_name: str, template: str):
os.remove(bootstrap_path)

# Template the feature_store.yaml file
feature_store_yaml_path = repo_path / "feature_repo" / "feature_store.yaml"
feature_repo_path = repo_path / "feature_repo"
feature_store_yaml_path = feature_repo_path / "feature_store.yaml"

# user-defined project name
replace_str_in_file(
feature_store_yaml_path, "project: my_project", f"project: {repo_name}"
)

# registry: replace relative path from template with absolute path
replace_str_in_file(
feature_store_yaml_path,
"registry: data/registry.db",
f"registry: {feature_repo_path}/data/registry.db",
)

# online store: replace relative path from template with absolute path
replace_str_in_file(
feature_store_yaml_path,
"path: data/online_store.db",
f"path: {feature_repo_path}/data/online_store.db",
)

# Remove the __pycache__ folder if it exists
import shutil

Expand Down

Back | FazBrowse Home | New Git URL