21
21
from feast .errors import (
22
22
FeastFeatureServerTypeInvalidError ,
23
23
FeastFeatureServerTypeSetError ,
24
+ FeastOfflineStoreInvalidName ,
25
+ FeastOnlineStoreInvalidName ,
24
26
FeastProviderNotSetError ,
25
27
)
26
28
from feast .importer import import_class
@@ -278,7 +280,8 @@ def _validate_online_store_config(cls, values):
278
280
return values
279
281
280
282
# Make sure that the provider configuration is set. We need it to set the defaults
281
- assert "provider" in values
283
+ if "provider" not in values :
284
+ raise FeastProviderNotSetError ()
282
285
283
286
# Set the default type
284
287
# This is only direct reference to a provider or online store that we should have
@@ -315,7 +318,8 @@ def _validate_offline_store_config(cls, values):
315
318
return values
316
319
317
320
# Make sure that the provider configuration is set. We need it to set the defaults
318
- assert "provider" in values
321
+ if "provider" not in values :
322
+ raise FeastProviderNotSetError ()
319
323
320
324
# Set the default type
321
325
if "type" not in values ["offline_store" ]:
@@ -455,8 +459,8 @@ def get_batch_engine_config_from_type(batch_engine_type: str):
455
459
def get_online_config_from_type (online_store_type : str ):
456
460
if online_store_type in ONLINE_STORE_CLASS_FOR_TYPE :
457
461
online_store_type = ONLINE_STORE_CLASS_FOR_TYPE [online_store_type ]
458
- else :
459
- assert online_store_type . endswith ( "OnlineStore" )
462
+ elif not online_store_type . endswith ( "OnlineStore" ) :
463
+ raise FeastOnlineStoreInvalidName ( online_store_type )
460
464
module_name , online_store_class_type = online_store_type .rsplit ("." , 1 )
461
465
config_class_name = f"{ online_store_class_type } Config"
462
466
@@ -466,8 +470,8 @@ def get_online_config_from_type(online_store_type: str):
466
470
def get_offline_config_from_type (offline_store_type : str ):
467
471
if offline_store_type in OFFLINE_STORE_CLASS_FOR_TYPE :
468
472
offline_store_type = OFFLINE_STORE_CLASS_FOR_TYPE [offline_store_type ]
469
- else :
470
- assert offline_store_type . endswith ( "OfflineStore" )
473
+ elif not offline_store_type . endswith ( "OfflineStore" ) :
474
+ raise FeastOfflineStoreInvalidName ( offline_store_type )
471
475
module_name , offline_store_class_type = offline_store_type .rsplit ("." , 1 )
472
476
config_class_name = f"{ offline_store_class_type } Config"
473
477
0 commit comments