Visitar URL original
feat: Force absolute paths in file based registries by boliri · Pull Request #4774 · feast-dev/feast · GitHub
Skip to content
Closed
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
Next Next commit
feat: Force users to specify absolute paths when a File Registry is c…
…onfigured in feature_store.yaml
  • Loading branch information
boliri committed Nov 20, 2024
commit 00ece9cf7abb350d6bb00f0786b47a9860b59fa0
8 changes: 8 additions & 0 deletions sdk/python/feast/errors.py
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
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