Skip to content

Commit

Permalink
Return sorted peers set (#86)
Browse files Browse the repository at this point in the history
* sort peers

* change type hint

* change type to tuple
  • Loading branch information
michaeldmitry authored Sep 27, 2024
1 parent 84000eb commit 5e9316d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "cosl"
version = "0.0.35"
version = "0.0.36"
authors = [
{ name="sed-i", email="[email protected]" },
]
Expand Down
5 changes: 3 additions & 2 deletions src/cosl/coordinated_workers/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
MutableMapping,
Optional,
Set,
Tuple,
)
from urllib.parse import urlparse

Expand Down Expand Up @@ -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."""
Expand Down

0 comments on commit 5e9316d

Please sign in to comment.