Skip to content

Commit

Permalink
fix filter to include 169.254.* since thats what mac uses for ethernet
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexCheema committed Jan 22, 2025
1 parent 8ab9977 commit 9ba8bbb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
20 changes: 11 additions & 9 deletions exo/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import tempfile
import json
from concurrent.futures import ThreadPoolExecutor
import traceback

DEBUG = int(os.getenv("DEBUG", default="0"))
DEBUG_DISCOVERY = int(os.getenv("DEBUG_DISCOVERY", default="0"))
Expand Down Expand Up @@ -230,20 +231,21 @@ def pretty_print_bytes_per_second(bytes_per_second: int) -> str:


def get_all_ip_addresses_and_interfaces():
try:
ip_addresses = []
for interface in get_if_list():
ip = get_if_addr(interface)
# Include all addresses, including loopback
# Filter out link-local addresses
if not ip.startswith('169.254.') and not ip.startswith('0.0.'):
# Remove "\\Device\\NPF_" prefix from interface name
try:
ip = get_if_addr(interface)
if ip.startswith("0.0."): continue
simplified_interface = re.sub(r'^\\Device\\NPF_', '', interface)
ip_addresses.append((ip, simplified_interface))
except:
if DEBUG >= 1: print(f"Failed to get IP address for interface {interface}")
if DEBUG >= 1: traceback.print_exc()
if not ip_addresses:
if DEBUG >= 1: print("Failed to get any IP addresses. Defaulting to localhost.")
return [("localhost", "lo")]
return list(set(ip_addresses))
except:
if DEBUG >= 1: print("Failed to get all IP addresses. Defaulting to localhost.")
return [("localhost", "lo")]



async def get_macos_interface_type(ifname: str) -> Optional[Tuple[int, str]]:
Expand Down
1 change: 0 additions & 1 deletion exo/inference/mlx/sharded_inference_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,3 @@ async def ensure_shard(self, shard: Shard):

async def cleanup(self):
self._mlx_thread.shutdown(wait=True)

0 comments on commit 9ba8bbb

Please sign in to comment.