Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix i6pn main address being None (typo) #2351

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modal/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def wrapper(*args, **kwargs):

def get_i6pn():
"""Returns the ipv6 address assigned to this container."""
socket.getaddrinfo("i6pn.modal.local", None, socket.AF_INET6)[0][4][0]
return socket.getaddrinfo("i6pn.modal.local", None, socket.AF_INET6)[0][4][0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[0][4][0]

is very confusing to me. Could you create named variables? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there was some discussion here about this. Personally I agree with Eric that [0][4][0] is something that can just be black-boxed (which was sort of the goal of the get_i6pn() function -- readers just need to know that the function returns the ipv6 address and don't need to know how it's done).

I'm open to other ideas though! In particular, I don't even know what to name the variables if I were to make each one a variable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Magic incantations without comments will likely trigger questions from every unfamiliar reader. Imo it's either "literate programming" or adding comments to the source.


hostname = socket.gethostname()
addr_info = get_i6pn()
Expand All @@ -179,6 +179,7 @@ def get_i6pn():
elif rank == 0:
q.put_many([addr_info for _ in range(size)])
main_ip = q.get()
assert main_ip is not None, "Failed to get main i6pn address"

os.environ["MODAL_MAIN_I6PN"] = f"{main_ip}"
os.environ["MODAL_WORLD_SIZE"] = f"{size}"
Expand Down
Loading