From 5e9316d093cbe6b3daf15c5d67f7499481382320 Mon Sep 17 00:00:00 2001 From: Michael Dmitry <33381599+michaeldmitry@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:56:20 +0300 Subject: [PATCH] Return sorted peers set (#86) * sort peers * change type hint * change type to tuple --- pyproject.toml | 2 +- src/cosl/coordinated_workers/interface.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d1f1e3d..b5a3be4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "cosl" -version = "0.0.35" +version = "0.0.36" authors = [ { name="sed-i", email="82407168+sed-i@users.noreply.github.com" }, ] diff --git a/src/cosl/coordinated_workers/interface.py b/src/cosl/coordinated_workers/interface.py index e1bcef0..146704a 100644 --- a/src/cosl/coordinated_workers/interface.py +++ b/src/cosl/coordinated_workers/interface.py @@ -23,6 +23,7 @@ MutableMapping, Optional, Set, + Tuple, ) from urllib.parse import urlparse @@ -330,14 +331,14 @@ def gather_addresses_by_role(self) -> Dict[str, Set[str]]: continue return data - def gather_addresses(self) -> Set[str]: + def gather_addresses(self) -> Tuple[str, ...]: """Go through the worker's unit databags to collect all the addresses published by the units.""" data: Set[str] = set() addresses_by_role = self.gather_addresses_by_role() for _, address_set in addresses_by_role.items(): data.update(address_set) - return data + return tuple(sorted(data)) def gather_roles(self) -> Dict[str, int]: """Go through the worker's app databags and sum the available application roles."""