Skip to content

Commit

Permalink
chore: Remove existing providers from the repo (feast-dev#4298)
Browse files Browse the repository at this point in the history
remove providers

Signed-off-by: tokoko <[email protected]>
  • Loading branch information
tokoko authored Jun 26, 2024
1 parent 86af60a commit 372fd75
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 235 deletions.
12 changes: 0 additions & 12 deletions sdk/python/feast/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,11 @@ def __init__(self, provider_name):
super().__init__(f"Provider '{provider_name}' is not implemented")


class FeastProviderNotSetError(Exception):
def __init__(self):
super().__init__("Provider is not set, but is required")


class FeastRegistryNotSetError(Exception):
def __init__(self):
super().__init__("Registry is not set, but is required")


class FeastFeatureServerTypeSetError(Exception):
def __init__(self, feature_server_type: str):
super().__init__(
f"Feature server type was set to {feature_server_type}, but the type should be determined by the provider"
)


class FeastFeatureServerTypeInvalidError(Exception):
def __init__(self, feature_server_type: str):
super().__init__(
Expand Down
9 changes: 0 additions & 9 deletions sdk/python/feast/infra/aws.py

This file was deleted.

72 changes: 0 additions & 72 deletions sdk/python/feast/infra/contrib/azure_provider.py

This file was deleted.

9 changes: 0 additions & 9 deletions sdk/python/feast/infra/gcp.py

This file was deleted.

23 changes: 0 additions & 23 deletions sdk/python/feast/infra/local.py

This file was deleted.

13 changes: 13 additions & 0 deletions sdk/python/feast/infra/passthrough_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from feast.feature_logging import FeatureServiceLoggingSource
from feast.feature_service import FeatureService
from feast.feature_view import FeatureView
from feast.infra.infra_object import Infra, InfraObject
from feast.infra.materialization.batch_materialization_engine import (
BatchMaterializationEngine,
MaterializationJobStatus,
Expand All @@ -22,6 +23,7 @@
from feast.infra.online_stores.helpers import get_online_store_from_config
from feast.infra.provider import Provider
from feast.infra.registry.base_registry import BaseRegistry
from feast.protos.feast.core.Registry_pb2 import Registry as RegistryProto
from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
from feast.protos.feast.types.Value_pb2 import Value as ValueProto
from feast.repo_config import BATCH_ENGINE_CLASS_FOR_TYPE, RepoConfig
Expand Down Expand Up @@ -103,6 +105,17 @@ def batch_engine(self) -> BatchMaterializationEngine:
self._batch_engine = _batch_engine
return _batch_engine

def plan_infra(
self, config: RepoConfig, desired_registry_proto: RegistryProto
) -> Infra:
infra = Infra()
if self.online_store:
infra_objects: List[InfraObject] = self.online_store.plan(
config, desired_registry_proto
)
infra.infra_objects += infra_objects
return infra

def update_infra(
self,
project: str,
Expand Down
8 changes: 4 additions & 4 deletions sdk/python/feast/infra/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
from feast.saved_dataset import SavedDataset

PROVIDERS_CLASS_FOR_TYPE = {
"gcp": "feast.infra.gcp.GcpProvider",
"aws": "feast.infra.aws.AwsProvider",
"local": "feast.infra.local.LocalProvider",
"azure": "feast.infra.contrib.azure_provider.AzureProvider",
"gcp": "feast.infra.passthrough_provider.PassthroughProvider",
"aws": "feast.infra.passthrough_provider.PassthroughProvider",
"local": "feast.infra.passthrough_provider.PassthroughProvider",
"azure": "feast.infra.passthrough_provider.PassthroughProvider",
}


Expand Down
66 changes: 6 additions & 60 deletions sdk/python/feast/repo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@

from feast.errors import (
FeastFeatureServerTypeInvalidError,
FeastFeatureServerTypeSetError,
FeastOfflineStoreInvalidName,
FeastOnlineStoreInvalidName,
FeastProviderNotSetError,
FeastRegistryNotSetError,
FeastRegistryTypeInvalidError,
)
Expand Down Expand Up @@ -85,10 +83,6 @@
"local": "feast.infra.feature_servers.local_process.config.LocalFeatureServerConfig",
}

FEATURE_SERVER_TYPE_FOR_PROVIDER = {
"local": "local",
}


class FeastBaseModel(BaseModel):
"""Feast Pydantic Configuration Class"""
Expand Down Expand Up @@ -138,7 +132,7 @@ class RepoConfig(FeastBaseModel):
provider account, as long as they have different project ids.
"""

provider: StrictStr
provider: StrictStr = "local"
""" str: local or gcp or aws """

registry_config: Any = Field(alias="registry", default="data/registry.db")
Expand Down Expand Up @@ -191,30 +185,10 @@ def __init__(self, **data: Any):
self.registry_config = data["registry"]

self._offline_store = None
if "offline_store" in data:
self.offline_config = data["offline_store"]
else:
if data["provider"] == "local":
self.offline_config = "file"
elif data["provider"] == "gcp":
self.offline_config = "bigquery"
elif data["provider"] == "aws":
self.offline_config = "redshift"
elif data["provider"] == "azure":
self.offline_config = "mssql"
self.offline_config = data.get("offline_store", "file")

self._online_store = None
if "online_store" in data:
self.online_config = data["online_store"]
else:
if data["provider"] == "local":
self.online_config = "sqlite"
elif data["provider"] == "gcp":
self.online_config = "datastore"
elif data["provider"] == "aws":
self.online_config = "dynamodb"
elif data["provider"] == "rockset":
self.online_config = "rockset"
self.online_config = data.get("online_store", "sqlite")

self._batch_engine = None
if "batch_engine" in data:
Expand Down Expand Up @@ -325,20 +299,11 @@ def _validate_online_store_config(cls, values: Any) -> Any:
values["online_store"] = None
return values

# Make sure that the provider configuration is set. We need it to set the defaults
if "provider" not in values:
raise FeastProviderNotSetError()

# Set the default type
# This is only direct reference to a provider or online store that we should have
# for backwards compatibility.
if "type" not in values["online_store"]:
if values["provider"] == "local":
values["online_store"]["type"] = "sqlite"
elif values["provider"] == "gcp":
values["online_store"]["type"] = "datastore"
elif values["provider"] == "aws":
values["online_store"]["type"] = "dynamodb"
values["online_store"]["type"] = "sqlite"

online_store_type = values["online_store"]["type"]

Expand All @@ -361,20 +326,9 @@ def _validate_offline_store_config(cls, values: Any) -> Any:
if not isinstance(values["offline_store"], Dict):
return values

# Make sure that the provider configuration is set. We need it to set the defaults
if "provider" not in values:
raise FeastProviderNotSetError()

# Set the default type
if "type" not in values["offline_store"]:
if values["provider"] == "local":
values["offline_store"]["type"] = "file"
elif values["provider"] == "gcp":
values["offline_store"]["type"] = "bigquery"
elif values["provider"] == "aws":
values["offline_store"]["type"] = "redshift"
if values["provider"] == "azure":
values["offline_store"]["type"] = "mssql"
values["offline_store"]["type"] = "file"

offline_store_type = values["offline_store"]["type"]

Expand All @@ -398,15 +352,7 @@ def _validate_feature_server_config(cls, values: Any) -> Any:
if not isinstance(values["feature_server"], Dict):
return values

# Make sure that the provider configuration is set. We need it to set the defaults
if "provider" not in values:
raise FeastProviderNotSetError()

default_type = FEATURE_SERVER_TYPE_FOR_PROVIDER.get(values["provider"])
defined_type = values["feature_server"].get("type", default_type)
# Make sure that the type is either not set, or set correctly, since it's defined by the provider
if defined_type not in (default_type, "local"):
raise FeastFeatureServerTypeSetError(defined_type)
defined_type = values["feature_server"].get("type", "local")
values["feature_server"]["type"] = defined_type

# Validate the dict to ensure one of the union types match
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def retrieval_job(request, environment):
iam_role="arn:aws:iam::585132637328:role/service-role/AmazonRedshift-CommandsAccessRole-20240403T092631",
workgroup="",
)
config = environment.config.copy(
config = environment.config.model_copy(
update={"offline_config": offline_store_config}
)
return RedshiftRetrievalJob(
Expand All @@ -147,7 +147,7 @@ def retrieval_job(request, environment):
storage_integration_name="FEAST_S3",
blob_export_location="s3://feast-snowflake-offload/export",
)
config = environment.config.copy(
config = environment.config.model_copy(
update={"offline_config": offline_store_config}
)
environment.project = "project"
Expand Down
Loading

0 comments on commit 372fd75

Please sign in to comment.