Skip to content

Add undeliverable message handling for Python actors #516

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions python/monarch/_src/actor/actor_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
OncePortRef,
PortReceiver as HyPortReceiver,
PortRef,
UndeliverablePortReceiver,
)
from monarch._rust_bindings.monarch_hyperactor.proc import ActorId
from monarch._rust_bindings.monarch_hyperactor.shape import Point as HyPoint, Shape
Expand Down Expand Up @@ -727,6 +728,11 @@ def _pickle(obj: object) -> bytes:


class Actor(MeshTrait):
def __init__(self) -> None:
# Bind undeliverable message port
# TODO: Temporary fix to avoid warning spam. Fix tracked in T230700229
undeliverable_receiver()

@functools.cached_property
def logger(cls) -> logging.Logger:
lgr = logging.getLogger(cls.__class__.__name__)
Expand Down Expand Up @@ -877,6 +883,10 @@ def current_rank() -> Point:
return ctx.point


def undeliverable_receiver() -> UndeliverablePortReceiver:
return MonarchContext.get().mailbox.undeliverable_receiver()


def current_size() -> Dict[str, int]:
ctx = MonarchContext.get()
return dict(zip(ctx.point.shape.labels, ctx.point.shape.ndslice.sizes))