Skip to content

Commit

Permalink
handle no network adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed Jun 26, 2024
1 parent 48b1bd9 commit 489f95d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,16 @@ def set_environment(env_updates=None):


def get_local_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
s.connect(("8.8.8.8", 80))
ip = s.getsockname()[0]
finally:
s.close()
return ip
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
s.connect(("8.8.8.8", 80))
ip = s.getsockname()[0]
finally:
s.close()
return ip
except Exception as e:
return "localhost"


def get_cuda_vram():
Expand Down

0 comments on commit 489f95d

Please sign in to comment.