Skip to content

Commit 5caf128

Browse files
pzhan9facebook-github-bot
authored andcommitted
Remove USE_STANDIN_ACTOR_MESH and any dead code along with that
Summary: We have been using multicast for ~1 month without any issues. It is time to remove this gate. Differential Revision: D82691879
1 parent e4cbb58 commit 5caf128

File tree

8 files changed

+13
-277
lines changed

8 files changed

+13
-277
lines changed

monarch_hyperactor/src/mailbox.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use hyperactor::mailbox::monitored_return_handle;
3333
use hyperactor::message::Bind;
3434
use hyperactor::message::Bindings;
3535
use hyperactor::message::Unbind;
36-
use hyperactor_mesh::comm::multicast::set_cast_info_on_headers;
3736
use monarch_types::PickledPyObject;
3837
use monarch_types::py_global;
3938
use pyo3::IntoPyObjectExt;
@@ -52,7 +51,6 @@ use crate::proc::PyActorId;
5251
use crate::pytokio::PyPythonTask;
5352
use crate::pytokio::PythonTask;
5453
use crate::runtime::signal_safe_block_on;
55-
use crate::shape::PyShape;
5654

5755
#[derive(Clone, Debug)]
5856
#[pyclass(
@@ -139,37 +137,6 @@ impl PyMailbox {
139137
Ok(())
140138
}
141139

142-
pub(super) fn post_cast(
143-
&self,
144-
dest: &PyActorId,
145-
rank: usize,
146-
shape: &PyShape,
147-
message: &PythonMessage,
148-
) -> PyResult<()> {
149-
let port_id = dest.inner.port_id(PythonMessage::port());
150-
let mut headers = Attrs::new();
151-
set_cast_info_on_headers(
152-
&mut headers,
153-
rank,
154-
shape.inner.clone(),
155-
self.inner.actor_id().clone(),
156-
);
157-
let message = Serialized::serialize(message).map_err(|err| {
158-
PyRuntimeError::new_err(format!(
159-
"failed to serialize message ({:?}) to Serialized: {}",
160-
message, err
161-
))
162-
})?;
163-
let envelope =
164-
MessageEnvelope::new(self.inner.actor_id().clone(), port_id, message, headers);
165-
let return_handle = self
166-
.inner
167-
.bound_return_handle()
168-
.unwrap_or(monitored_return_handle());
169-
self.inner.post(envelope, return_handle);
170-
Ok(())
171-
}
172-
173140
#[getter]
174141
pub(super) fn actor_id(&self) -> PyActorId {
175142
PyActorId {

monarch_hyperactor/src/proc_mesh.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use std::sync::Arc;
1212
use std::sync::atomic::AtomicBool;
1313

1414
use hyperactor::Actor;
15-
use hyperactor::Mailbox;
1615
use hyperactor::RemoteMessage;
1716
use hyperactor::WorldId;
1817
use hyperactor::actor::RemoteActor;
@@ -48,7 +47,6 @@ use crate::mailbox::PyMailbox;
4847
use crate::pytokio::PyPythonTask;
4948
use crate::pytokio::PyShared;
5049
use crate::pytokio::PythonTask;
51-
use crate::runtime::get_tokio_runtime;
5250
use crate::shape::PyShape;
5351
use crate::supervision::SupervisionError;
5452
use crate::supervision::Unhealthy;
@@ -339,7 +337,6 @@ impl PyProcMesh {
339337
proc_mesh: &mut PyShared,
340338
name: String,
341339
actor: Py<PyType>,
342-
emulated: bool,
343340
) -> PyResult<PyObject> {
344341
let task = proc_mesh.task()?.take_task()?;
345342
let meshimpl = async move {
@@ -367,15 +364,8 @@ impl PyProcMesh {
367364
actor_events,
368365
))
369366
};
370-
if emulated {
371-
// we give up on doing mesh spawn async for the emulated old version
372-
// it is too complicated to make both work.
373-
let r = get_tokio_runtime().block_on(meshimpl)?;
374-
Python::with_gil(|py| r.into_py_any(py))
375-
} else {
376-
let r = PythonActorMesh::new(meshimpl);
377-
Python::with_gil(|py| r.into_py_any(py))
378-
}
367+
let r = PythonActorMesh::new(meshimpl);
368+
Python::with_gil(|py| r.into_py_any(py))
379369
}
380370
// User can call this to monitor the proc mesh events. This will override
381371
// the default monitor that exits the client on process crash, so user can

python/monarch/_rust_bindings/monarch_hyperactor/actor_mesh.pyi

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ from typing_extensions import Self
2222

2323
class ActorMeshProtocol(Protocol):
2424
"""
25-
Protocol defining the common interface for actor mesh, mesh ref and _ActorMeshRefImpl.
25+
Protocol defining the common interface for actor mesh and mesh ref.
2626
"""
2727

2828
def cast(
@@ -40,34 +40,6 @@ class ActorMeshProtocol(Protocol):
4040
class PythonActorMesh(ActorMeshProtocol):
4141
pass
4242

43-
class PythonActorMeshImpl:
44-
def get_supervision_event(self) -> ActorSupervisionEvent | None:
45-
"""
46-
Returns supervision event if there is any.
47-
"""
48-
...
49-
50-
def get(self, rank: int) -> ActorId | None:
51-
"""
52-
Get the actor id for the actor at the given rank.
53-
"""
54-
...
55-
56-
def stop(self) -> PythonTask[None]:
57-
"""
58-
Stop all actors that are part of this mesh.
59-
Using this mesh after stop() is called will raise an Exception.
60-
"""
61-
...
62-
63-
def supervision_event(self) -> "Optional[Shared[Exception]]": ...
64-
@property
65-
def stopped(self) -> bool:
66-
"""
67-
If the mesh has been stopped.
68-
"""
69-
...
70-
7143
@final
7244
class ActorSupervisionEvent:
7345
@property

python/monarch/_rust_bindings/monarch_hyperactor/mailbox.pyi

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,6 @@ class Mailbox:
162162
"""
163163
...
164164

165-
def post_cast(
166-
self, dest: ActorId, rank: int, shape: Shape, message: PythonMessage
167-
) -> None:
168-
"""
169-
Post a message to the provided actor. It will be handled using the handle_cast
170-
endpoint as if the destination was `rank` of `shape`.
171-
"""
172-
...
173-
174165
def undeliverable_receiver(self) -> UndeliverablePortReceiver:
175166
"""
176167
Open a port to receive undeliverable messages.

python/monarch/_rust_bindings/monarch_hyperactor/proc_mesh.pyi

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ from typing import Any, AsyncIterator, final, Literal, overload, Type, TYPE_CHEC
1010

1111
if TYPE_CHECKING:
1212
from monarch._rust_bindings.monarch_hyperactor.actor import Actor
13-
from monarch._rust_bindings.monarch_hyperactor.actor_mesh import (
14-
PythonActorMesh,
15-
PythonActorMeshImpl,
16-
)
13+
from monarch._rust_bindings.monarch_hyperactor.actor_mesh import PythonActorMesh
1714

1815
from monarch._rust_bindings.monarch_hyperactor.alloc import Alloc
1916
from monarch._rust_bindings.monarch_hyperactor.mailbox import Mailbox
@@ -50,7 +47,7 @@ class ProcMesh:
5047

5148
@staticmethod
5249
def spawn_async(
53-
proc_mesh: Shared["ProcMesh"], name: str, actor: Type["Actor"], emulated: bool
50+
proc_mesh: Shared["ProcMesh"], name: str, actor: Type["Actor"]
5451
) -> PythonActorMesh: ...
5552
async def monitor(self) -> ProcMeshMonitor:
5653
"""

0 commit comments

Comments
 (0)