← back to Exo
topo fix only take your own as source of truth
50e4a966e0b8f2e3386e19fb31a5cc1a80aa91a6 · 2024-12-07 15:03:42 +0000 · Alex Cheema
Files touched
M exo/networking/grpc/grpc_peer_handle.pyM exo/networking/peer_handle.pyM exo/orchestration/node.pyM exo/orchestration/standard_node.py
Diff
commit 50e4a966e0b8f2e3386e19fb31a5cc1a80aa91a6
Author: Alex Cheema <alexcheema123@gmail.com>
Date: Sat Dec 7 15:03:42 2024 +0000
topo fix only take your own as source of truth
---
exo/networking/grpc/grpc_peer_handle.py | 4 +++-
exo/networking/peer_handle.py | 2 +-
exo/orchestration/node.py | 2 +-
exo/orchestration/standard_node.py | 2 +-
4 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/exo/networking/grpc/grpc_peer_handle.py b/exo/networking/grpc/grpc_peer_handle.py
index 1eb0bb6b..156b9916 100644
--- a/exo/networking/grpc/grpc_peer_handle.py
+++ b/exo/networking/grpc/grpc_peer_handle.py
@@ -117,11 +117,12 @@ class GRPCPeerHandle(PeerHandle):
response.is_finished,
)
- async def collect_topology(self, visited: set[str], max_depth: int) -> Topology:
+ async def collect_topology(self, my_node_id: str, visited: set[str], max_depth: int) -> Topology:
request = node_service_pb2.CollectTopologyRequest(visited=visited, max_depth=max_depth)
response = await self.stub.CollectTopology(request)
topology = Topology()
for node_id, capabilities in response.nodes.items():
+ if node_id == my_node_id: continue
device_capabilities = DeviceCapabilities(
model=capabilities.model,
chip=capabilities.chip,
@@ -130,6 +131,7 @@ class GRPCPeerHandle(PeerHandle):
)
topology.update_node(node_id, device_capabilities)
for node_id, peer_connections in response.peer_graph.items():
+ if node_id == my_node_id: continue
for conn in peer_connections.connections:
topology.add_edge(node_id, conn.to_id, conn.description)
return topology
diff --git a/exo/networking/peer_handle.py b/exo/networking/peer_handle.py
index 45d37c4b..1b92b42a 100644
--- a/exo/networking/peer_handle.py
+++ b/exo/networking/peer_handle.py
@@ -56,5 +56,5 @@ class PeerHandle(ABC):
pass
@abstractmethod
- async def collect_topology(self, visited: set[str], max_depth: int) -> Topology:
+ async def collect_topology(self, my_node_id: str, visited: set[str], max_depth: int) -> Topology:
pass
diff --git a/exo/orchestration/node.py b/exo/orchestration/node.py
index 2df59bb5..945a5819 100644
--- a/exo/orchestration/node.py
+++ b/exo/orchestration/node.py
@@ -28,7 +28,7 @@ class Node(ABC):
pass
@abstractmethod
- async def collect_topology(self, visited: set[str] = set(), max_depth: int = 2) -> Topology:
+ async def collect_topology(self, my_node_id: str, visited: set[str] = set(), max_depth: int = 2) -> Topology:
pass
@property
diff --git a/exo/orchestration/standard_node.py b/exo/orchestration/standard_node.py
index dbb146a8..73350ebb 100644
--- a/exo/orchestration/standard_node.py
+++ b/exo/orchestration/standard_node.py
@@ -408,7 +408,7 @@ class StandardNode(Node):
continue
try:
- other_topology = await asyncio.wait_for(peer.collect_topology(visited, max_depth=max_depth - 1), timeout=5.0)
+ other_topology = await asyncio.wait_for(peer.collect_topology(self.id, visited, max_depth=max_depth - 1), timeout=5.0)
if DEBUG >= 2: print(f"Collected topology from: {peer.id()}: {other_topology}")
next_topology.merge(other_topology)
except Exception as e:
← 6d09b4ae add special case for USB adapter over ethernet
·
back to Exo
·
ignore topology merges from the non-owner 69c18d9a →