Visitar URL original
fix: Remote apply using offline store by dmartinol · Pull Request #4559 · feast-dev/feast · GitHub
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
fixed linting, added permission asserts
Signed-off-by: Daniele Martinoli <dmartino@redhat.com>
  • Loading branch information
dmartinol committed Oct 15, 2024
commit dbf1ea60c8af30a7fa2d979dc240a68d0e1fb661
2 changes: 1 addition & 1 deletion sdk/python/feast/infra/offline_stores/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def validate_data_source(
)

api_parameters = {
"data_source_name": data_source.name,
"data_source_proto": str(data_source),
}
logger.debug(f"validating DataSource {data_source.name}")
_call_put(
Expand Down
1 change: 0 additions & 1 deletion sdk/python/feast/infra/passthrough_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
MaterializationJobStatus,
MaterializationTask,
)
from feast.infra.offline_stores.file_source import FileSource
from feast.infra.offline_stores.offline_store import RetrievalJob
from feast.infra.offline_stores.offline_utils import get_offline_store_from_config
from feast.infra.online_stores.helpers import get_online_store_from_config
Expand Down
40 changes: 21 additions & 19 deletions sdk/python/feast/offline_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
import traceback
from datetime import datetime
from typing import Any, Dict, List, cast
from feast.protos.feast.core.DataSource_pb2 import DataSource as DataSourceProto

import pyarrow as pa
import pyarrow.flight as fl
from google.protobuf.json_format import MessageToDict, Parse
from google.protobuf.json_format import Parse

from feast import FeatureStore, FeatureView, utils
from feast.arrow_error_handler import arrow_server_error_handling_decorator
from feast.data_source import DataSource
from feast.errors import FeastObjectNotFoundException
from feast.feature_logging import FeatureServiceLoggingSource
from feast.feature_view import DUMMY_ENTITY_NAME
from feast.infra.offline_stores.offline_utils import get_offline_store_from_config
Expand All @@ -30,6 +28,7 @@
init_security_manager,
str_to_auth_manager_type,
)
from feast.protos.feast.core.DataSource_pb2 import DataSource as DataSourceProto
from feast.saved_dataset import SavedDatasetStorage

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -469,27 +468,30 @@ def persist(self, command: dict, key: str):
traceback.print_exc()
raise e

def validate_data_source(self, command: dict):
data_source_name = command["data_source_name"]
logger.debug(f"Validating data source {data_source_name}")
try:
data_source = self.store.registry.get_data_source(
name=data_source_name, project=self.store.config.project
)
self.offline_store.validate_data_source(
config=self.store.config,
data_source=data_source,
)
except FeastObjectNotFoundException:
logger.debug(f"DataSource {data_source_name} not found, validation skipped")

def get_table_column_names_and_types_from_data_source(self, command: dict):
@staticmethod
def _extract_data_source_from_command(command) -> DataSource:
data_source_proto_str = command["data_source_proto"]
logger.debug(f"Fetching table columns metadata from {data_source_proto_str}")
logger.debug(f"Extracted data_source_proto {data_source_proto_str}")
data_source_proto = DataSourceProto()
Parse(data_source_proto_str, data_source_proto)
data_source = DataSource.from_proto(data_source_proto)
logger.debug(f"Converted to DataSource {data_source}")
return data_source

def validate_data_source(self, command: dict):
data_source = OfflineServer._extract_data_source_from_command(command)
logger.debug(f"Validating data source {data_source.name}")
assert_permissions(data_source, actions=[AuthzedAction.READ_OFFLINE])

self.offline_store.validate_data_source(
config=self.store.config,
data_source=data_source,
)

def get_table_column_names_and_types_from_data_source(self, command: dict):
data_source = OfflineServer._extract_data_source_from_command(command)
logger.debug(f"Fetching table columns metadata from {data_source.name}")
assert_permissions(data_source, actions=[AuthzedAction.READ_OFFLINE])

column_names_and_types = data_source.get_table_column_names_and_types(
self.store.config
Expand Down