20
20
from feast .errors import (
21
21
FeastFeatureServerTypeInvalidError ,
22
22
FeastFeatureServerTypeSetError ,
23
+ FeastOfflineStoreInvalidName ,
24
+ FeastOnlineStoreInvalidName ,
23
25
FeastProviderNotSetError ,
24
26
)
25
27
from feast .importer import import_class
@@ -217,7 +219,8 @@ def _validate_online_store_config(cls, values):
217
219
return values
218
220
219
221
# Make sure that the provider configuration is set. We need it to set the defaults
220
- assert "provider" in values
222
+ if "provider" not in values :
223
+ raise FeastProviderNotSetError ()
221
224
222
225
# Set the default type
223
226
# This is only direct reference to a provider or online store that we should have
@@ -253,7 +256,8 @@ def _validate_offline_store_config(cls, values):
253
256
return values
254
257
255
258
# Make sure that the provider configuration is set. We need it to set the defaults
256
- assert "provider" in values
259
+ if "provider" not in values :
260
+ raise FeastProviderNotSetError ()
257
261
258
262
# Set the default type
259
263
if "type" not in values ["offline_store" ]:
@@ -375,8 +379,8 @@ def get_data_source_class_from_type(data_source_type: str):
375
379
def get_online_config_from_type (online_store_type : str ):
376
380
if online_store_type in ONLINE_STORE_CLASS_FOR_TYPE :
377
381
online_store_type = ONLINE_STORE_CLASS_FOR_TYPE [online_store_type ]
378
- else :
379
- assert online_store_type . endswith ( "OnlineStore" )
382
+ elif not online_store_type . endswith ( "OnlineStore" ) :
383
+ raise FeastOnlineStoreInvalidName ( online_store_type )
380
384
module_name , online_store_class_type = online_store_type .rsplit ("." , 1 )
381
385
config_class_name = f"{ online_store_class_type } Config"
382
386
@@ -386,8 +390,8 @@ def get_online_config_from_type(online_store_type: str):
386
390
def get_offline_config_from_type (offline_store_type : str ):
387
391
if offline_store_type in OFFLINE_STORE_CLASS_FOR_TYPE :
388
392
offline_store_type = OFFLINE_STORE_CLASS_FOR_TYPE [offline_store_type ]
389
- else :
390
- assert offline_store_type . endswith ( "OfflineStore" )
393
+ elif not offline_store_type . endswith ( "OfflineStore" ) :
394
+ raise FeastOfflineStoreInvalidName ( offline_store_type )
391
395
module_name , offline_store_class_type = offline_store_type .rsplit ("." , 1 )
392
396
config_class_name = f"{ offline_store_class_type } Config"
393
397
0 commit comments