Skip to content

Commit ff62a9d

Browse files
committed
simplify
1 parent e637eac commit ff62a9d

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

sdk/python/feast/feature_server.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -346,24 +346,25 @@ async def _get_feast_object(
346346
) -> FeastObject:
347347
# FIXME: this logic repeated at least 3 times in the codebase - should be centralized
348348
# in logging, in server and in feature_store (Python SDK)
349-
potential_sources = [
350-
store.get_feature_view,
351-
store.get_on_demand_feature_view,
352-
store.get_stream_feature_view,
353-
]
354-
355-
for source in potential_sources:
349+
try:
350+
return await run_in_threadpool(
351+
store.get_stream_feature_view,
352+
feature_view_name,
353+
allow_registry_cache=allow_registry_cache,
354+
)
355+
except FeatureViewNotFoundException:
356356
try:
357357
return await run_in_threadpool(
358-
source,
358+
store.get_feature_view,
359359
feature_view_name,
360360
allow_registry_cache=allow_registry_cache,
361361
)
362362
except FeatureViewNotFoundException:
363-
continue
364-
365-
# By this point, none of the sources found the feature view
366-
raise FeatureViewNotFoundException(feature_view_name)
363+
return await run_in_threadpool(
364+
store.get_on_demand_feature_view,
365+
feature_view_name,
366+
allow_registry_cache=allow_registry_cache,
367+
)
367368

368369
@app.post("/write-to-online-store", dependencies=[Depends(inject_user_details)])
369370
async def write_to_online_store(request: WriteToFeatureStoreRequest) -> None:

0 commit comments

Comments
 (0)