[object Object]

← back to Exo

handle mutable visited properly

dba720445387961d8a9fac0673600089e04d1261 · 2024-12-05 21:38:03 +0000 · Alex Cheema

Files touched

Diff

commit dba720445387961d8a9fac0673600089e04d1261
Author: Alex Cheema <alexcheema123@gmail.com>
Date:   Thu Dec 5 21:38:03 2024 +0000

    handle mutable visited properly
---
 exo/orchestration/standard_node.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/exo/orchestration/standard_node.py b/exo/orchestration/standard_node.py
index 1deb7c04..310f18f6 100644
--- a/exo/orchestration/standard_node.py
+++ b/exo/orchestration/standard_node.py
@@ -56,7 +56,7 @@ class StandardNode(Node):
     await self.server.start()
     await self.discovery.start()
     await self.update_peers(wait_for_peers)
-    await self.collect_topology()
+    await self.collect_topology(set())
     if DEBUG >= 2: print(f"Collected topology: {self.topology}")
     asyncio.create_task(self.periodic_topology_collection(1.0))
 
@@ -374,8 +374,8 @@ class StandardNode(Node):
       try:
         did_peers_change = await self.update_peers()
         if DEBUG >= 2: print(f"{did_peers_change=}")
+        await self.collect_topology(set())
         if did_peers_change:
-          await self.collect_topology()
           await self.select_best_inference_engine()
       except Exception as e:
         print(f"Error collecting topology: {e}")
@@ -386,7 +386,7 @@ class StandardNode(Node):
       return None, False
     return np.array(self.buffered_token_output[request_id][0]), self.buffered_token_output[request_id][1]
 
-  async def collect_topology(self, visited: set[str] = set(), max_depth: int = 4) -> Topology:
+  async def collect_topology(self, visited: set[str], max_depth: int = 4) -> Topology:
     next_topology = Topology()
     next_topology.update_node(self.id, self.device_capabilities)
 

← 99b5bf01 fix topology merging  ·  back to Exo  ·  only collect topology when peers changed f8d195ee →