From 99f5300e49b91a904fdfc6697cb83750c048940f Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Mon, 9 Dec 2024 11:31:03 -0500 Subject: [PATCH] Don't require node IDs to parse as ints --- message_passing/safe_message_handlers/activities.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/message_passing/safe_message_handlers/activities.py b/message_passing/safe_message_handlers/activities.py index f3e369ce..da8a8be0 100644 --- a/message_passing/safe_message_handlers/activities.py +++ b/message_passing/safe_message_handlers/activities.py @@ -18,7 +18,7 @@ class ClusterState: @activity.defn async def start_cluster() -> ClusterState: - return ClusterState(node_ids=[f"{i}" for i in range(25)]) + return ClusterState(node_ids=[f"node-{i}" for i in range(25)]) @activity.defn @@ -47,7 +47,7 @@ class FindBadNodesInput: @activity.defn async def find_bad_nodes(input: FindBadNodesInput) -> Set[str]: await asyncio.sleep(0.1) - bad_nodes = set([n for n in input.nodes_to_check if int(n) % 5 == 0]) + bad_nodes = set([id for id in input.nodes_to_check if hash(id) % 5 == 0]) if bad_nodes: print(f"Found bad nodes: {bad_nodes}") else: