diff --git a/sdk/python/feast/feature_server.py b/sdk/python/feast/feature_server.py index fee7e56e9c1..e88b1eb5c28 100644 --- a/sdk/python/feast/feature_server.py +++ b/sdk/python/feast/feature_server.py @@ -344,18 +344,27 @@ async def push(request: PushFeaturesRequest) -> None: async def _get_feast_object( feature_view_name: str, allow_registry_cache: bool ) -> FeastObject: + # FIXME: this logic repeated at least 3 times in the codebase - should be centralized + # in logging, in server and in feature_store (Python SDK) try: - return await run_in_threadpool( - store.get_stream_feature_view, - feature_view_name, - allow_registry_cache=allow_registry_cache, - ) - except FeatureViewNotFoundException: return await run_in_threadpool( store.get_feature_view, feature_view_name, allow_registry_cache=allow_registry_cache, ) + except FeatureViewNotFoundException: + try: + return await run_in_threadpool( + store.get_on_demand_feature_view, + feature_view_name, + allow_registry_cache=allow_registry_cache, + ) + except FeatureViewNotFoundException: + return await run_in_threadpool( + store.get_stream_feature_view, + feature_view_name, + allow_registry_cache=allow_registry_cache, + ) @app.post("/write-to-online-store", dependencies=[Depends(inject_user_details)]) async def write_to_online_store(request: WriteToFeatureStoreRequest) -> None: