From 46f0b6606a95ba4c1336774d911416c2608ec79f Mon Sep 17 00:00:00 2001 From: Dinesh Yeduguru Date: Wed, 13 Nov 2024 22:20:57 -0800 Subject: [PATCH] init registry once (#450) We are calling the initialize function on the registery in the common routing table impl, which is incorrect as the common routing table is the base class inherited by each resource's routing table. this change moves remove that and add the initialize to the creation, where it inits once server run. Co-authored-by: Dinesh Yeduguru --- llama_stack/distribution/routers/routing_tables.py | 2 -- llama_stack/distribution/store/registry.py | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/llama_stack/distribution/routers/routing_tables.py b/llama_stack/distribution/routers/routing_tables.py index 861c830be..a940dbae6 100644 --- a/llama_stack/distribution/routers/routing_tables.py +++ b/llama_stack/distribution/routers/routing_tables.py @@ -64,8 +64,6 @@ class CommonRoutingTableImpl(RoutingTable): self.dist_registry = dist_registry async def initialize(self) -> None: - # Initialize the registry if not already done - await self.dist_registry.initialize() async def add_objects( objs: List[RoutableObjectWithProvider], provider_id: str, cls diff --git a/llama_stack/distribution/store/registry.py b/llama_stack/distribution/store/registry.py index b876ee756..041a5677c 100644 --- a/llama_stack/distribution/store/registry.py +++ b/llama_stack/distribution/store/registry.py @@ -216,5 +216,6 @@ async def create_dist_registry( db_path=(DISTRIBS_BASE_DIR / image_name / "kvstore.db").as_posix() ) ) - - return CachedDiskDistributionRegistry(dist_kvstore), dist_kvstore + dist_registry = CachedDiskDistributionRegistry(dist_kvstore) + await dist_registry.initialize() + return dist_registry, dist_kvstore