fix(service): patch the model_store rather than set/reset
@@ -125,7 +125,7 @@ def import_service(
module_name = import_path
# Import the service using the Bento's own model store
- BentoMLContainer.model_store.set(model_store)
+ with BentoMLContainer.model_store.patch(model_store):
try:
module = importlib.import_module(module_name, package=working_dir)
except ImportError as e:
@@ -134,9 +134,6 @@ def import_service(
f'current path: {repr(sys.path)}. working dir: "{working_dir}", '
f'current dir: "{os.getcwd()}"'
)
- finally:
- # Reset to default local model store
- BentoMLContainer.model_store.reset()
if attrs_str:
instance = module
