Skip to content

Commit c1b63a1

Browse files
pzhan9facebook-github-bot
authored andcommitted
Remove USE_STANDIN_ACTOR_MESH and any dead code along with that (meta-pytorch#1273)
Summary: We have been using multicast for ~1 month without any issues. It is time to remove this gate. Differential Revision: D82691879
1 parent ce078dd commit c1b63a1

File tree

8 files changed

+15
-281
lines changed

8 files changed

+15
-281
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: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ use crate::mailbox::PyMailbox;
4949
use crate::pytokio::PyPythonTask;
5050
use crate::pytokio::PyShared;
5151
use crate::pytokio::PythonTask;
52-
use crate::runtime::get_tokio_runtime;
5352
use crate::shape::PyRegion;
5453
use crate::supervision::SupervisionError;
5554
use crate::supervision::Unhealthy;
@@ -340,7 +339,6 @@ impl PyProcMesh {
340339
proc_mesh: &mut PyShared,
341340
name: String,
342341
actor: Py<PyType>,
343-
emulated: bool,
344342
) -> PyResult<PyObject> {
345343
let task = proc_mesh.task()?.take_task()?;
346344
let meshimpl = async move {
@@ -368,18 +366,11 @@ impl PyProcMesh {
368366
actor_events,
369367
)))
370368
};
371-
if emulated {
372-
// we give up on doing mesh spawn async for the emulated old version
373-
// it is too complicated to make both work.
374-
let r = get_tokio_runtime().block_on(meshimpl)?;
375-
Python::with_gil(|py| r.into_py_any(py))
376-
} else {
377-
let r = PythonActorMesh::new(async move {
378-
let meshimpl: Box<dyn ActorMeshProtocol> = meshimpl.await?;
379-
Ok(meshimpl)
380-
});
381-
Python::with_gil(|py| r.into_py_any(py))
382-
}
369+
let r = PythonActorMesh::new(async move {
370+
let meshimpl: Box<dyn ActorMeshProtocol> = meshimpl.await?;
371+
Ok(meshimpl)
372+
});
373+
Python::with_gil(|py| r.into_py_any(py))
383374
}
384375

385376
// User can call this to monitor the proc mesh events. This will override

python/monarch/_rust_bindings/monarch_hyperactor/actor_mesh.pyi

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

1818
class ActorMeshProtocol(Protocol):
1919
"""
20-
Protocol defining the common interface for actor mesh, mesh ref and _ActorMeshRefImpl.
20+
Protocol defining the common interface for actor mesh and mesh ref.
2121
"""
2222

2323
def cast(
@@ -35,34 +35,6 @@ class ActorMeshProtocol(Protocol):
3535
class PythonActorMesh(ActorMeshProtocol):
3636
pass
3737

38-
class PythonActorMeshImpl:
39-
def get_supervision_event(self) -> ActorSupervisionEvent | None:
40-
"""
41-
Returns supervision event if there is any.
42-
"""
43-
...
44-
45-
def get(self, rank: int) -> ActorId | None:
46-
"""
47-
Get the actor id for the actor at the given rank.
48-
"""
49-
...
50-
51-
def stop(self) -> PythonTask[None]:
52-
"""
53-
Stop all actors that are part of this mesh.
54-
Using this mesh after stop() is called will raise an Exception.
55-
"""
56-
...
57-
58-
def supervision_event(self) -> "Optional[Shared[Exception]]": ...
59-
@property
60-
def stopped(self) -> bool:
61-
"""
62-
If the mesh has been stopped.
63-
"""
64-
...
65-
6638
@final
6739
class ActorSupervisionEvent:
6840
@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.context import Instance
@@ -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)