Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/backend/server/rpc_connection_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def node_update(self, message):
new_rtt_to_nodes=node.rtt_to_nodes,
is_active=node.is_active,
)
return {}
# Return current layer allocation to node
layer_allocation = self.get_layer_allocation(node.node_id)
return layer_allocation
except Exception as e:
logger.exception(f"node_update error: {e}")
return {}
Expand Down
27 changes: 26 additions & 1 deletion src/parallax/p2p/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,32 @@ def _announcer_thread():
# Announce the range ID
try:
if self.scheduler_peer_id is not None:
self.scheduler_stub.node_update(self.get_node_info(is_update=True))
response_future = self.scheduler_stub.node_update(
self.get_node_info(is_update=True)
)
# Get the response result
response = (
response_future.result(timeout=30)
if hasattr(response_future, "result")
else response_future
)

# Print layer allocation information
if response and isinstance(response, dict):
start_layer = response.get("start_layer")
end_layer = response.get("end_layer")
model_name = response.get("model_name")
if start_layer is not None and end_layer is not None:
logger.debug(
f"Heartbeat: Node {self.lattica.peer_id()}... "
f"Model: {model_name}, Layers: [{start_layer}, {end_layer})"
)
else:
logger.warning(f"Heartbeat response: {response}")
else:
logger.warning(
f"Heartbeat: No layer allocation received yet, response: {response}"
)
else:
self.lattica.store(
key=self.prefix_id,
Expand Down