From 432fba5460326766274c3fbe919f86898b3eb3b0 Mon Sep 17 00:00:00 2001 From: suo Date: Tue, 8 Jul 2025 11:23:54 -0700 Subject: [PATCH] [monarch/ext] fold monarch_hyperactor into actor_extension Now we have achieved a good end-state for the actor native layer. - One rust extension (`actor_extension`) for defining bindings from actor stuff -> Python. - Exposed names in the extension directly map to the names in the `actor_extension` module hierarchy. Differential Revision: [D77949213](https://our.internmc.facebook.com/intern/diff/D77949213/) [ghstack-poisoned] --- actor_extension/Cargo.toml | 15 +++- .../bin/process_allocator/common.rs | 0 .../bin/process_allocator/main.rs | 0 .../src/actor.rs | 16 ++-- .../src/actor_mesh.rs | 2 +- .../src/alloc.rs | 20 ++--- .../src/bootstrap.rs | 5 +- .../src/channel.rs | 7 +- actor_extension/src/code_sync.rs | 7 +- .../src/config.rs | 0 actor_extension/src/lib.rs | 86 +++++++------------ .../src/mailbox.rs | 34 +++----- .../src/ndslice.rs | 6 +- .../src/proc.rs | 16 ++-- .../src/proc_mesh.rs | 12 +-- .../src/runtime.rs | 5 +- .../src/selection.rs | 2 +- .../src/shape.rs | 8 +- monarch_extension/Cargo.toml | 2 +- monarch_extension/src/client.rs | 12 +-- monarch_extension/src/controller.rs | 4 +- monarch_extension/src/convert.rs | 4 +- monarch_extension/src/debugger.rs | 8 +- monarch_extension/src/mesh_controller.rs | 12 +-- monarch_extension/src/simulator_client.rs | 2 +- monarch_extension/src/tensor_worker.rs | 6 +- monarch_hyperactor/Cargo.toml | 30 ------- monarch_hyperactor/src/lib.rs | 23 ----- monarch_tensor_worker/Cargo.toml | 2 +- monarch_tensor_worker/src/lib.rs | 4 +- monarch_tensor_worker/src/stream.rs | 2 +- python/monarch/_monarch/selection/__init__.py | 2 +- .../monarch_extension/client.pyi | 8 +- .../monarch_extension/controller.pyi | 4 +- .../monarch_extension/debugger.pyi | 2 +- .../monarch_extension/mesh_controller.pyi | 8 +- .../monarch_extension/tensor_worker.pyi | 4 +- python/monarch/_rust_bindings/old.pyi | 6 +- .../{monarch_hyperactor => }/actor.pyi | 14 +-- .../{monarch_hyperactor => }/actor_mesh.pyi | 10 +-- .../{monarch_hyperactor => }/alloc.pyi | 0 .../{monarch_hyperactor => }/bootstrap.pyi | 0 .../{monarch_hyperactor => }/channel.pyi | 0 .../_src/actor/_extension/code_sync.pyi | 4 +- .../{monarch_hyperactor => }/mailbox.pyi | 6 +- .../{monarch_hyperactor => }/proc.pyi | 7 +- .../{monarch_hyperactor => }/proc_mesh.pyi | 10 +-- .../{monarch_hyperactor => }/runtime.pyi | 0 .../{monarch_hyperactor => }/selection.pyi | 0 .../{monarch_hyperactor => }/shape.pyi | 0 python/monarch/_src/actor/actor_mesh.py | 16 ++-- python/monarch/_src/actor/allocator.py | 4 +- python/monarch/_src/actor/bootstrap_main.py | 4 +- python/monarch/_src/actor/debugger.py | 2 +- python/monarch/_src/actor/pdb_wrapper.py | 2 +- python/monarch/_src/actor/proc_mesh.py | 8 +- python/monarch/_src/actor/shape.py | 2 +- python/monarch/common/invocation.py | 2 +- python/monarch/common/selection.py | 2 +- python/monarch/controller/controller.py | 2 +- python/monarch/controller/history.py | 2 +- .../controller/rust_backend/controller.py | 2 +- python/monarch/mesh_controller.py | 10 +-- python/monarch/rdma.py | 2 +- python/monarch/rust_backend_mesh.py | 2 +- python/monarch/rust_local_mesh.py | 2 +- python/monarch/sim_mesh.py | 2 +- python/monarch/simulator/mock_controller.py | 2 +- python/monarch/simulator/simulator.py | 2 +- python/monarch/tools/mesh_spec.py | 2 +- python/tests/_monarch/test_actor.py | 2 +- python/tests/_monarch/test_client.py | 2 +- python/tests/_monarch/test_controller.py | 2 +- python/tests/_monarch/test_hyperactor.py | 15 ++-- python/tests/_monarch/test_mailbox.py | 26 ++---- python/tests/_monarch/test_ndslice.py | 4 +- python/tests/_monarch/test_worker.py | 2 +- python/tests/sleep_binary.py | 2 +- python/tests/test_actor_error.py | 2 +- python/tests/test_alloc.py | 2 +- python/tests/test_allocator.py | 10 +-- python/tests/test_future.py | 2 +- 82 files changed, 207 insertions(+), 373 deletions(-) rename {monarch_hyperactor/src => actor_extension}/bin/process_allocator/common.rs (100%) rename {monarch_hyperactor/src => actor_extension}/bin/process_allocator/main.rs (100%) rename {monarch_hyperactor => actor_extension}/src/actor.rs (97%) rename {monarch_hyperactor => actor_extension}/src/actor_mesh.rs (96%) rename {monarch_hyperactor => actor_extension}/src/alloc.rs (96%) rename {monarch_hyperactor => actor_extension}/src/bootstrap.rs (92%) rename {monarch_hyperactor => actor_extension}/src/channel.rs (96%) rename {monarch_hyperactor => actor_extension}/src/config.rs (100%) rename {monarch_hyperactor => actor_extension}/src/mailbox.rs (95%) rename {monarch_hyperactor => actor_extension}/src/ndslice.rs (98%) rename {monarch_hyperactor => actor_extension}/src/proc.rs (98%) rename {monarch_hyperactor => actor_extension}/src/proc_mesh.rs (97%) rename {monarch_hyperactor => actor_extension}/src/runtime.rs (97%) rename {monarch_hyperactor => actor_extension}/src/selection.rs (94%) rename {monarch_hyperactor => actor_extension}/src/shape.rs (96%) delete mode 100644 monarch_hyperactor/Cargo.toml delete mode 100644 monarch_hyperactor/src/lib.rs rename python/monarch/_src/actor/_extension/{monarch_hyperactor => }/actor.pyi (94%) rename python/monarch/_src/actor/_extension/{monarch_hyperactor => }/actor_mesh.pyi (73%) rename python/monarch/_src/actor/_extension/{monarch_hyperactor => }/alloc.pyi (100%) rename python/monarch/_src/actor/_extension/{monarch_hyperactor => }/bootstrap.pyi (100%) rename python/monarch/_src/actor/_extension/{monarch_hyperactor => }/channel.pyi (100%) rename python/monarch/_src/actor/_extension/{monarch_hyperactor => }/mailbox.pyi (96%) rename python/monarch/_src/actor/_extension/{monarch_hyperactor => }/proc.pyi (95%) rename python/monarch/_src/actor/_extension/{monarch_hyperactor => }/proc_mesh.pyi (87%) rename python/monarch/_src/actor/_extension/{monarch_hyperactor => }/runtime.pyi (100%) rename python/monarch/_src/actor/_extension/{monarch_hyperactor => }/selection.pyi (100%) rename python/monarch/_src/actor/_extension/{monarch_hyperactor => }/shape.pyi (100%) diff --git a/actor_extension/Cargo.toml b/actor_extension/Cargo.toml index 1ceddbb2..f345be3b 100644 --- a/actor_extension/Cargo.toml +++ b/actor_extension/Cargo.toml @@ -1,7 +1,7 @@ -# @generated by autocargo from //monarch/actor_extension:actor_extension-lib +# @generated by autocargo from //monarch/actor_extension:[actor_extension-lib,process_allocator-oss] [package] -name = "_extension" +name = "actor_extension_lib" version = "0.0.0" authors = ["Meta"] edition = "2021" @@ -14,14 +14,23 @@ crate-type = ["cdylib"] [dependencies] anyhow = "1.0.98" +async-trait = "0.1.86" bincode = "1.3.3" +clap = { version = "4.5.38", features = ["derive", "env", "string", "unicode", "wrap_help"] } +erased-serde = "0.3.27" +fbinit = { version = "0.2.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" } hyperactor = { version = "0.0.0", path = "../hyperactor" } hyperactor_mesh = { version = "0.0.0", path = "../hyperactor_mesh" } +hyperactor_multiprocess = { version = "0.0.0", path = "../hyperactor_multiprocess" } hyperactor_telemetry = { version = "0.0.0", path = "../hyperactor_telemetry" } +inventory = "0.3.8" libc = "0.2.139" -monarch_hyperactor = { version = "0.0.0", path = "../monarch_hyperactor" } +monarch_types = { version = "0.0.0", path = "../monarch_types" } +ndslice = { version = "0.0.0", path = "../ndslice" } pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods"] } pyo3-async-runtimes = { version = "0.24", features = ["attributes", "tokio-runtime"] } serde = { version = "1.0.185", features = ["derive", "rc"] } +serde_bytes = "0.11" +thiserror = "2.0.12" tokio = { version = "1.45.0", features = ["full", "test-util", "tracing"] } tracing = { version = "0.1.41", features = ["attributes", "valuable"] } diff --git a/monarch_hyperactor/src/bin/process_allocator/common.rs b/actor_extension/bin/process_allocator/common.rs similarity index 100% rename from monarch_hyperactor/src/bin/process_allocator/common.rs rename to actor_extension/bin/process_allocator/common.rs diff --git a/monarch_hyperactor/src/bin/process_allocator/main.rs b/actor_extension/bin/process_allocator/main.rs similarity index 100% rename from monarch_hyperactor/src/bin/process_allocator/main.rs rename to actor_extension/bin/process_allocator/main.rs diff --git a/monarch_hyperactor/src/actor.rs b/actor_extension/src/actor.rs similarity index 97% rename from monarch_hyperactor/src/actor.rs rename to actor_extension/src/actor.rs index c066aa48..a33075af 100644 --- a/monarch_hyperactor/src/actor.rs +++ b/actor_extension/src/actor.rs @@ -52,10 +52,7 @@ use crate::proc::PySerialized; use crate::runtime::signal_safe_block_on; use crate::shape::PyShape; -#[pyclass( - frozen, - module = "monarch._src.actor._extension.monarch_hyperactor.actor" -)] +#[pyclass(frozen, module = "monarch._src.actor._extension.actor")] #[derive(Serialize, Deserialize, Named)] pub struct PickledMessage { sender_actor_id: ActorId, @@ -99,7 +96,7 @@ impl PickledMessage { } } -#[pyclass(module = "monarch._src.actor._extension.monarch_hyperactor.actor")] +#[pyclass(module = "monarch._src.actor._extension.actor")] pub struct PickledMessageClientActor { instance: Arc>>, } @@ -174,10 +171,7 @@ impl PickledMessageClientActor { } } -#[pyclass( - frozen, - module = "monarch._src.actor._extension.monarch_hyperactor.actor" -)] +#[pyclass(frozen, module = "monarch._src.actor._extension.actor")] #[derive(Default, Clone, Serialize, Deserialize, Named, PartialEq)] pub struct PythonMessage { pub(crate) method: String, @@ -266,7 +260,7 @@ impl PythonMessage { } } -#[pyclass(module = "monarch._src.actor._extension.monarch_hyperactor.actor")] +#[pyclass(module = "monarch._src.actor._extension.actor")] pub(super) struct PythonActorHandle { pub(super) inner: ActorHandle, } @@ -391,7 +385,7 @@ fn create_task_locals() -> pyo3_async_runtimes::TaskLocals { // in Python, can catch the PanicException and notify the Rust awaiter manually. // In this way we can guarantee that the awaiter will complete even if the // `PyTaskCompleter` callback explodes. -#[pyclass(module = "monarch._src.actor._extension.monarch_hyperactor.actor")] +#[pyclass(module = "monarch._src.actor._extension.actor")] struct PanicFlag { sender: Option>, } diff --git a/monarch_hyperactor/src/actor_mesh.rs b/actor_extension/src/actor_mesh.rs similarity index 96% rename from monarch_hyperactor/src/actor_mesh.rs rename to actor_extension/src/actor_mesh.rs index 357e0bd6..c72c126e 100644 --- a/monarch_hyperactor/src/actor_mesh.rs +++ b/actor_extension/src/actor_mesh.rs @@ -26,7 +26,7 @@ use crate::shape::PyShape; #[pyclass( name = "PythonActorMesh", - module = "monarch._src.actor._extension.monarch_hyperactor.actor_mesh" + module = "monarch._src.actor._extension.actor_mesh" )] pub struct PythonActorMesh { pub(super) inner: SharedCell>, diff --git a/monarch_hyperactor/src/alloc.rs b/actor_extension/src/alloc.rs similarity index 96% rename from monarch_hyperactor/src/alloc.rs rename to actor_extension/src/alloc.rs index b36c87db..aeabdd20 100644 --- a/monarch_hyperactor/src/alloc.rs +++ b/actor_extension/src/alloc.rs @@ -41,7 +41,7 @@ use crate::runtime::signal_safe_block_on; #[pyclass( name = "LocalAllocatorBase", - module = "monarch._src.actor._extension.monarch_hyperactor.alloc", + module = "monarch._src.actor._extension.alloc", subclass )] pub struct PyLocalAllocator; @@ -88,7 +88,7 @@ impl PyLocalAllocator { #[pyclass( name = "ProcessAllocatorBase", - module = "monarch._src.actor._extension.monarch_hyperactor.alloc", + module = "monarch._src.actor._extension.alloc", subclass )] pub struct PyProcessAllocator { @@ -156,7 +156,7 @@ impl PyProcessAllocator { /// Basically follows https://pyo3.rs/v0.25.0/trait-bounds.html. /// The Python subclass should implement `def initialize_alloc(self) -> list[str]`. pub struct PyRemoteProcessAllocInitializer { - // instance of a Python subclass of `monarch._src.actor._extension.monarch_hyperactor.alloc.RemoteProcessAllocInitializer`. + // instance of a Python subclass of `monarch._src.actor._extension.alloc.RemoteProcessAllocInitializer`. py_inner: Py, // allocation constraints passed onto the allocator's allocate call and passed along to python initializer. @@ -234,7 +234,7 @@ impl RemoteProcessAllocInitializer for PyRemoteProcessAllocInitializer { #[pyclass( name = "RemoteAllocatorBase", - module = "monarch._src.actor._extension.monarch_hyperactor.alloc", + module = "monarch._src.actor._extension.alloc", subclass )] pub struct PyRemoteAllocator { @@ -335,10 +335,7 @@ impl PyRemoteAllocator { /// A python class that wraps a Rust Alloc trait object. It represents what /// is shown on the python side. Internals are not exposed. /// It ensures that the Alloc is only used once (i.e. moved) in rust. -#[pyclass( - name = "Alloc", - module = "monarch._src.actor._extension.monarch_hyperactor.alloc" -)] +#[pyclass(name = "Alloc", module = "monarch._src.actor._extension.alloc")] pub struct PyAlloc { pub inner: Arc>>, } @@ -399,7 +396,7 @@ impl Alloc for PyAllocWrapper { #[pyclass( name = "AllocConstraints", - module = "monarch._src.actor._extension.monarch_hyperactor.alloc" + module = "monarch._src.actor._extension.alloc" )] pub struct PyAllocConstraints { inner: AllocConstraints, @@ -419,10 +416,7 @@ impl PyAllocConstraints { } } -#[pyclass( - name = "AllocSpec", - module = "monarch._src.actor._extension.monarch_hyperactor.alloc" -)] +#[pyclass(name = "AllocSpec", module = "monarch._src.actor._extension.alloc")] pub struct PyAllocSpec { pub inner: AllocSpec, } diff --git a/monarch_hyperactor/src/bootstrap.rs b/actor_extension/src/bootstrap.rs similarity index 92% rename from monarch_hyperactor/src/bootstrap.rs rename to actor_extension/src/bootstrap.rs index 315f2318..8b343b24 100644 --- a/monarch_hyperactor/src/bootstrap.rs +++ b/actor_extension/src/bootstrap.rs @@ -38,10 +38,7 @@ pub fn bootstrap_main(py: Python) -> PyResult> { pub fn register_python_bindings(hyperactor_mod: &Bound<'_, PyModule>) -> PyResult<()> { let f = wrap_pyfunction!(bootstrap_main, hyperactor_mod)?; - f.setattr( - "__module__", - "monarch._src.actor._extension.monarch_hyperactor.bootstrap", - )?; + f.setattr("__module__", "monarch._src.actor._extension.bootstrap")?; hyperactor_mod.add_function(f)?; Ok(()) diff --git a/monarch_hyperactor/src/channel.rs b/actor_extension/src/channel.rs similarity index 96% rename from monarch_hyperactor/src/channel.rs rename to actor_extension/src/channel.rs index e27d100d..3ca28a53 100644 --- a/monarch_hyperactor/src/channel.rs +++ b/actor_extension/src/channel.rs @@ -16,7 +16,7 @@ use pyo3::prelude::*; /// Python binding for [`hyperactor::channel::ChannelTransport`] #[pyclass( name = "ChannelTransport", - module = "monarch._src.actor._extension.monarch_hyperactor.channel", + module = "monarch._src.actor._extension.channel", eq )] #[derive(PartialEq, Clone, Copy, Debug)] @@ -28,10 +28,7 @@ pub enum PyChannelTransport { // Sim(/*proxy address:*/ ChannelAddr), TODO kiuk@ add support } -#[pyclass( - name = "ChannelAddr", - module = "monarch._src.actor._extension.monarch_hyperactor.channel" -)] +#[pyclass(name = "ChannelAddr", module = "monarch._src.actor._extension.channel")] pub struct PyChannelAddr { inner: ChannelAddr, } diff --git a/actor_extension/src/code_sync.rs b/actor_extension/src/code_sync.rs index eb8f6226..04020818 100644 --- a/actor_extension/src/code_sync.rs +++ b/actor_extension/src/code_sync.rs @@ -16,9 +16,6 @@ use hyperactor_mesh::code_sync::WorkspaceLocation; use hyperactor_mesh::code_sync::rsync; use hyperactor_mesh::shape::Shape; use hyperactor_mesh::shared_cell::SharedCell; -use monarch_hyperactor::proc_mesh::PyProcMesh; -use monarch_hyperactor::runtime::signal_safe_block_on; -use monarch_hyperactor::shape::PyShape; use pyo3::Bound; use pyo3::exceptions::PyRuntimeError; use pyo3::exceptions::PyValueError; @@ -28,6 +25,10 @@ use pyo3::types::PyModule; use serde::Deserialize; use serde::Serialize; +use crate::proc_mesh::PyProcMesh; +use crate::runtime::signal_safe_block_on; +use crate::shape::PyShape; + #[pyclass( frozen, name = "WorkspaceLocation", diff --git a/monarch_hyperactor/src/config.rs b/actor_extension/src/config.rs similarity index 100% rename from monarch_hyperactor/src/config.rs rename to actor_extension/src/config.rs diff --git a/actor_extension/src/lib.rs b/actor_extension/src/lib.rs index 365396f7..df8fc03f 100644 --- a/actor_extension/src/lib.rs +++ b/actor_extension/src/lib.rs @@ -12,9 +12,22 @@ //! It is imported by `monarch` as `monarch._src.actor._extension`. use pyo3::prelude::*; +pub mod actor; +mod actor_mesh; +mod alloc; mod blocking; +mod bootstrap; +mod channel; mod code_sync; +mod config; +pub mod mailbox; +pub mod ndslice; mod panic; +pub mod proc; +pub mod proc_mesh; +pub mod runtime; +mod selection; +pub mod shape; mod telemetry; #[cfg(fbcode_build)] @@ -51,65 +64,26 @@ fn get_or_add_new_module<'py>( #[pymodule] #[pyo3(name = "_extension")] pub fn mod_init(module: &Bound<'_, PyModule>) -> PyResult<()> { - monarch_hyperactor::runtime::initialize(module.py())?; - let runtime = monarch_hyperactor::runtime::get_tokio_runtime(); - ::hyperactor::initialize(runtime.handle().clone()); - - monarch_hyperactor::shape::register_python_bindings(&get_or_add_new_module( - module, - "monarch_hyperactor.shape", - )?)?; - - monarch_hyperactor::selection::register_python_bindings(&get_or_add_new_module( - module, - "monarch_hyperactor.selection", - )?)?; - code_sync::register_python_bindings(&get_or_add_new_module(module, "code_sync")?)?; - monarch_hyperactor::bootstrap::register_python_bindings(&get_or_add_new_module( - module, - "monarch_hyperactor.bootstrap", - )?)?; - - monarch_hyperactor::proc::register_python_bindings(&get_or_add_new_module( - module, - "monarch_hyperactor.proc", - )?)?; - - monarch_hyperactor::actor::register_python_bindings(&get_or_add_new_module( - module, - "monarch_hyperactor.actor", - )?)?; + crate::runtime::initialize(module.py())?; + let runtime = crate::runtime::get_tokio_runtime(); - monarch_hyperactor::mailbox::register_python_bindings(&get_or_add_new_module( - module, - "monarch_hyperactor.mailbox", - )?)?; - - monarch_hyperactor::alloc::register_python_bindings(&get_or_add_new_module( - module, - "monarch_hyperactor.alloc", - )?)?; - monarch_hyperactor::channel::register_python_bindings(&get_or_add_new_module( - module, - "monarch_hyperactor.channel", - )?)?; - monarch_hyperactor::actor_mesh::register_python_bindings(&get_or_add_new_module( - module, - "monarch_hyperactor.actor_mesh", - )?)?; - monarch_hyperactor::proc_mesh::register_python_bindings(&get_or_add_new_module( - module, - "monarch_hyperactor.proc_mesh", - )?)?; - - monarch_hyperactor::runtime::register_python_bindings(&get_or_add_new_module( - module, - "monarch_hyperactor.runtime", - )?)?; - telemetry::register_python_bindings(&get_or_add_new_module(module, "telemetry")?)?; - crate::panic::register_python_bindings(&get_or_add_new_module(module, "panic")?)?; + ::hyperactor::initialize(runtime.handle().clone()); + crate::actor_mesh::register_python_bindings(&get_or_add_new_module(module, "actor_mesh")?)?; + crate::actor::register_python_bindings(&get_or_add_new_module(module, "actor")?)?; + crate::alloc::register_python_bindings(&get_or_add_new_module(module, "alloc")?)?; crate::blocking::register_python_bindings(&get_or_add_new_module(module, "blocking")?)?; + crate::bootstrap::register_python_bindings(&get_or_add_new_module(module, "bootstrap")?)?; + crate::channel::register_python_bindings(&get_or_add_new_module(module, "channel")?)?; + crate::code_sync::register_python_bindings(&get_or_add_new_module(module, "code_sync")?)?; + crate::mailbox::register_python_bindings(&get_or_add_new_module(module, "mailbox")?)?; + crate::panic::register_python_bindings(&get_or_add_new_module(module, "panic")?)?; + crate::proc_mesh::register_python_bindings(&get_or_add_new_module(module, "proc_mesh")?)?; + crate::proc::register_python_bindings(&get_or_add_new_module(module, "proc")?)?; + crate::runtime::register_python_bindings(&get_or_add_new_module(module, "runtime")?)?; + crate::selection::register_python_bindings(&get_or_add_new_module(module, "selection")?)?; + crate::shape::register_python_bindings(&get_or_add_new_module(module, "shape")?)?; + crate::telemetry::register_python_bindings(&get_or_add_new_module(module, "telemetry")?)?; #[cfg(fbcode_build)] crate::meta::register_python_bindings(&get_or_add_new_module(module, "meta")?)?; diff --git a/monarch_hyperactor/src/mailbox.rs b/actor_extension/src/mailbox.rs similarity index 95% rename from monarch_hyperactor/src/mailbox.rs rename to actor_extension/src/mailbox.rs index 3024ec50..e172f9d6 100644 --- a/monarch_hyperactor/src/mailbox.rs +++ b/actor_extension/src/mailbox.rs @@ -48,10 +48,7 @@ use crate::proc::PyActorId; use crate::runtime::signal_safe_block_on; use crate::shape::PyShape; #[derive(Clone, Debug)] -#[pyclass( - name = "Mailbox", - module = "monarch._src.actor._extension.monarch_hyperactor.mailbox" -)] +#[pyclass(name = "Mailbox", module = "monarch._src.actor._extension.mailbox")] pub(super) struct PyMailbox { pub(super) inner: Mailbox, } @@ -188,7 +185,7 @@ impl PyMailbox { #[pyclass( frozen, name = "PortId", - module = "monarch._src.actor._extension.monarch_hyperactor.mailbox" + module = "monarch._src.actor._extension.mailbox" )] #[derive(Clone)] pub struct PyPortId { @@ -268,10 +265,7 @@ impl std::fmt::Debug for PyPortId { } #[derive(Clone, Debug)] -#[pyclass( - name = "PortHandle", - module = "monarch._src.actor._extension.monarch_hyperactor.mailbox" -)] +#[pyclass(name = "PortHandle", module = "monarch._src.actor._extension.mailbox")] pub(super) struct PythonPortHandle { inner: PortHandle, } @@ -295,7 +289,7 @@ impl PythonPortHandle { #[derive(Clone, Debug)] #[pyclass( name = "UndeliverablePortHandle", - module = "monarch._src.actor._extension.monarch_hyperactor.mailbox" + module = "monarch._src.actor._extension.mailbox" )] pub(super) struct PythonUndeliverablePortHandle { inner: PortHandle>, @@ -309,10 +303,7 @@ impl PythonUndeliverablePortHandle { } #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] -#[pyclass( - name = "PortRef", - module = "monarch._src.actor._extension.monarch_hyperactor.mailbox" -)] +#[pyclass(name = "PortRef", module = "monarch._src.actor._extension.mailbox")] pub(super) struct PythonPortRef { pub(crate) inner: PortRef, } @@ -345,7 +336,7 @@ impl From> for PythonPortRef { #[derive(Debug)] #[pyclass( name = "PortReceiver", - module = "monarch._src.actor._extension.monarch_hyperactor.mailbox" + module = "monarch._src.actor._extension.mailbox" )] pub(super) struct PythonPortReceiver { inner: Arc>>, @@ -374,7 +365,7 @@ impl PythonPortReceiver { #[derive(Debug)] #[pyclass( name = "UndeliverableMessageEnvelope", - module = "monarch._src.actor._extension.monarch_hyperactor.mailbox" + module = "monarch._src.actor._extension.mailbox" )] pub(crate) struct PythonUndeliverableMessageEnvelope { #[allow(dead_code)] // At this time, field `inner` isn't read. @@ -384,7 +375,7 @@ pub(crate) struct PythonUndeliverableMessageEnvelope { #[derive(Debug)] #[pyclass( name = "UndeliverablePortReceiver", - module = "monarch._src.actor._extension.monarch_hyperactor.mailbox" + module = "monarch._src.actor._extension.mailbox" )] pub(super) struct PythonUndeliverablePortReceiver { inner: Arc>>>, @@ -420,7 +411,7 @@ impl PythonUndeliverablePortReceiver { #[derive(Debug)] #[pyclass( name = "OncePortHandle", - module = "monarch._src.actor._extension.monarch_hyperactor.mailbox" + module = "monarch._src.actor._extension.mailbox" )] pub(super) struct PythonOncePortHandle { inner: Option>, @@ -449,10 +440,7 @@ impl PythonOncePortHandle { } #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] -#[pyclass( - name = "OncePortRef", - module = "monarch._src.actor._extension.monarch_hyperactor.mailbox" -)] +#[pyclass(name = "OncePortRef", module = "monarch._src.actor._extension.mailbox")] pub(crate) struct PythonOncePortRef { pub(crate) inner: Option>, } @@ -492,7 +480,7 @@ impl From> for PythonOncePortRef { #[pyclass( name = "OncePortReceiver", - module = "monarch._src.actor._extension.monarch_hyperactor.mailbox" + module = "monarch._src.actor._extension.mailbox" )] pub(super) struct PythonOncePortReceiver { inner: std::sync::Mutex>>, diff --git a/monarch_hyperactor/src/ndslice.rs b/actor_extension/src/ndslice.rs similarity index 98% rename from monarch_hyperactor/src/ndslice.rs rename to actor_extension/src/ndslice.rs index 681f3c1c..0ecc5aac 100644 --- a/monarch_hyperactor/src/ndslice.rs +++ b/actor_extension/src/ndslice.rs @@ -25,11 +25,7 @@ use pyo3::types::PyTuple; /// representation of an n-dimensional array. Given an offset, sizes of /// each dimension, and strides for each dimension, Slice can compute /// indices into the flat array. -#[pyclass( - name = "Slice", - frozen, - module = "monarch._src.actor._extension.monarch_hyperactor.shape" -)] +#[pyclass(name = "Slice", frozen, module = "monarch._src.actor._extension.shape")] #[derive(Clone)] pub struct PySlice { inner: Arc, diff --git a/monarch_hyperactor/src/proc.rs b/actor_extension/src/proc.rs similarity index 98% rename from monarch_hyperactor/src/proc.rs rename to actor_extension/src/proc.rs index 8a0b12e0..ab931392 100644 --- a/monarch_hyperactor/src/proc.rs +++ b/actor_extension/src/proc.rs @@ -14,7 +14,7 @@ /// wheel and the rest of the codebase especially while things are in flux. Plus we are also /// building everything in hyperactor_python into this wheel already (i.e. hyperactor deps). /// 2. In order to support autoreload in bento, potentially pickling in the future etc we need to -/// have a well defined module for these deps which needs to be monarch._src.actor._extension.monarch_hyperactor.proc and +/// have a well defined module for these deps which needs to be monarch._src.actor._extension.proc and /// and making that the module of the classes in hyperactor python is weird. use std::collections::HashMap; use std::hash::DefaultHasher; @@ -69,10 +69,7 @@ use crate::runtime::signal_safe_block_on; /// Wrapper around a proc that provides utilities to implement a python actor. #[derive(Clone, Debug)] -#[pyclass( - name = "Proc", - module = "monarch._src.actor._extension.monarch_hyperactor.proc" -)] +#[pyclass(name = "Proc", module = "monarch._src.actor._extension.proc")] pub struct PyProc { pub(super) inner: Proc, } @@ -255,7 +252,7 @@ pub fn init_proc( #[pyclass( frozen, name = "ActorId", - module = "monarch._src.actor._extension.monarch_hyperactor.proc" + module = "monarch._src.actor._extension.proc" )] #[derive(Clone)] pub struct PyActorId { @@ -371,7 +368,7 @@ enum InstanceStatus { #[pyclass( frozen, name = "Serialized", - module = "monarch._src.actor._extension.monarch_hyperactor.proc" + module = "monarch._src.actor._extension.proc" )] #[derive(Debug)] pub struct PySerialized { @@ -681,10 +678,7 @@ async fn check_actor_supervision_state( pub fn register_python_bindings(hyperactor_mod: &Bound<'_, PyModule>) -> PyResult<()> { let f = wrap_pyfunction!(init_proc, hyperactor_mod)?; - f.setattr( - "__module__", - "monarch._src.actor._extension.monarch_hyperactor.proc", - )?; + f.setattr("__module__", "monarch._src.actor._extension.proc")?; hyperactor_mod.add_function(f)?; hyperactor_mod.add_class::()?; diff --git a/monarch_hyperactor/src/proc_mesh.rs b/actor_extension/src/proc_mesh.rs similarity index 97% rename from monarch_hyperactor/src/proc_mesh.rs rename to actor_extension/src/proc_mesh.rs index 20f47576..4b21b8b2 100644 --- a/monarch_hyperactor/src/proc_mesh.rs +++ b/actor_extension/src/proc_mesh.rs @@ -106,10 +106,7 @@ impl TrackedProcMesh { } } -#[pyclass( - name = "ProcMesh", - module = "monarch._src.actor._extension.monarch_hyperactor.proc_mesh" -)] +#[pyclass(name = "ProcMesh", module = "monarch._src.actor._extension.proc_mesh")] pub struct PyProcMesh { pub inner: SharedCell, keepalive: Keepalive, @@ -380,7 +377,7 @@ impl Drop for KeepaliveState { #[pyclass( name = "ProcMeshMonitor", - module = "monarch._src.actor._extension.monarch_hyperactor.proc_mesh" + module = "monarch._src.actor._extension.proc_mesh" )] pub struct PyProcMeshMonitor { proc_events: SharedCell>, @@ -417,10 +414,7 @@ impl PyProcMeshMonitor { } } -#[pyclass( - name = "ProcEvent", - module = "monarch._src.actor._extension.monarch_hyperactor.proc_mesh" -)] +#[pyclass(name = "ProcEvent", module = "monarch._src.actor._extension.proc_mesh")] pub enum PyProcEvent { /// The proc of the given rank was stopped with the provided reason. /// The arguments represent the rank id and stop reason. diff --git a/monarch_hyperactor/src/runtime.rs b/actor_extension/src/runtime.rs similarity index 97% rename from monarch_hyperactor/src/runtime.rs rename to actor_extension/src/runtime.rs index a1ffc226..6cdf343c 100644 --- a/monarch_hyperactor/src/runtime.rs +++ b/actor_extension/src/runtime.rs @@ -124,10 +124,7 @@ pub fn sleep_indefinitely_for_unit_tests(py: Python) -> PyResult<()> { pub fn register_python_bindings(runtime_mod: &Bound<'_, PyModule>) -> PyResult<()> { let sleep_indefinitely_fn = wrap_pyfunction!(sleep_indefinitely_for_unit_tests, runtime_mod.py())?; - sleep_indefinitely_fn.setattr( - "__module__", - "monarch._src.actor._extension.monarch_hyperactor.runtime", - )?; + sleep_indefinitely_fn.setattr("__module__", "monarch._src.actor._extension.runtime")?; runtime_mod.add_function(sleep_indefinitely_fn)?; Ok(()) } diff --git a/monarch_hyperactor/src/selection.rs b/actor_extension/src/selection.rs similarity index 94% rename from monarch_hyperactor/src/selection.rs rename to actor_extension/src/selection.rs index 3d73697c..09c576db 100644 --- a/monarch_hyperactor/src/selection.rs +++ b/actor_extension/src/selection.rs @@ -13,7 +13,7 @@ use pyo3::types::PyType; #[pyclass( name = "Selection", - module = "monarch._src.actor._extension.monarch_hyperactor.selection", + module = "monarch._src.actor._extension.selection", frozen )] pub struct PySelection { diff --git a/monarch_hyperactor/src/shape.rs b/actor_extension/src/shape.rs similarity index 96% rename from monarch_hyperactor/src/shape.rs rename to actor_extension/src/shape.rs index 8b73d727..9552d527 100644 --- a/monarch_hyperactor/src/shape.rs +++ b/actor_extension/src/shape.rs @@ -16,11 +16,7 @@ use pyo3::types::PyDict; use crate::ndslice::PySlice; -#[pyclass( - name = "Shape", - module = "monarch._src.actor._extension.monarch_hyperactor.shape", - frozen -)] +#[pyclass(name = "Shape", module = "monarch._src.actor._extension.shape", frozen)] pub struct PyShape { pub(super) inner: Shape, } @@ -126,7 +122,7 @@ impl From for PyShape { #[pyclass( name = "Point", - module = "monarch._src.actor._extension.monarch_hyperactor.shape", + module = "monarch._src.actor._extension.shape", subclass, frozen )] diff --git a/monarch_extension/Cargo.toml b/monarch_extension/Cargo.toml index 3500628d..4b031f26 100644 --- a/monarch_extension/Cargo.toml +++ b/monarch_extension/Cargo.toml @@ -14,6 +14,7 @@ doctest = false crate-type = ["cdylib"] [dependencies] +actor_extension_lib = { version = "0.0.0", path = "../actor_extension" } anyhow = "1.0.98" async-trait = "0.1.86" clap = { version = "4.5.38", features = ["derive", "env", "string", "unicode", "wrap_help"] } @@ -21,7 +22,6 @@ controller = { version = "0.0.0", path = "../controller", optional = true } hyperactor = { version = "0.0.0", path = "../hyperactor" } hyperactor_mesh = { version = "0.0.0", path = "../hyperactor_mesh" } hyperactor_multiprocess = { version = "0.0.0", path = "../hyperactor_multiprocess" } -monarch_hyperactor = { version = "0.0.0", path = "../monarch_hyperactor" } monarch_messages = { version = "0.0.0", path = "../monarch_messages", optional = true } monarch_simulator_lib = { version = "0.0.0", path = "../monarch_simulator", optional = true } monarch_tensor_worker = { version = "0.0.0", path = "../monarch_tensor_worker", optional = true } diff --git a/monarch_extension/src/client.rs b/monarch_extension/src/client.rs index 5e62338c..ad2898b4 100644 --- a/monarch_extension/src/client.rs +++ b/monarch_extension/src/client.rs @@ -9,6 +9,12 @@ use std::collections::HashMap; use std::sync::Arc; +use actor_extension_lib::proc::ControllerError; +use actor_extension_lib::proc::InstanceWrapper; +use actor_extension_lib::proc::PyActorId; +use actor_extension_lib::proc::PyProc; +use actor_extension_lib::proc::PySerialized; +use actor_extension_lib::runtime::signal_safe_block_on; use hyperactor::ActorRef; use hyperactor::WorldId; use hyperactor::clock::Clock; @@ -19,12 +25,6 @@ use hyperactor_multiprocess::system_actor::SystemMessageClient; use hyperactor_multiprocess::system_actor::SystemSnapshotFilter; use hyperactor_multiprocess::system_actor::WorldSnapshot; use hyperactor_multiprocess::system_actor::WorldSnapshotProcInfo; -use monarch_hyperactor::proc::ControllerError; -use monarch_hyperactor::proc::InstanceWrapper; -use monarch_hyperactor::proc::PyActorId; -use monarch_hyperactor::proc::PyProc; -use monarch_hyperactor::proc::PySerialized; -use monarch_hyperactor::runtime::signal_safe_block_on; use monarch_messages::client::ClientMessage; use monarch_messages::client::Exception; use monarch_messages::client::LogLevel; diff --git a/monarch_extension/src/controller.rs b/monarch_extension/src/controller.rs index a617c1d9..d95ee035 100644 --- a/monarch_extension/src/controller.rs +++ b/monarch_extension/src/controller.rs @@ -6,12 +6,12 @@ * LICENSE file in the root directory of this source tree. */ +use actor_extension_lib::ndslice::PySlice; +use actor_extension_lib::proc::PySerialized; /// These the controller messages that are exposed to python to allow the client to construct and /// send messages to the controller. For more details of the definitions take a look at /// [`monarch_messages::controller::ControllerMessage`]. use hyperactor::data::Serialized; -use monarch_hyperactor::ndslice::PySlice; -use monarch_hyperactor::proc::PySerialized; use monarch_messages::controller::Seq; use monarch_messages::controller::*; use monarch_messages::worker::Ref; diff --git a/monarch_extension/src/convert.rs b/monarch_extension/src/convert.rs index afda10ad..4fd621dc 100644 --- a/monarch_extension/src/convert.rs +++ b/monarch_extension/src/convert.rs @@ -9,9 +9,9 @@ use std::collections::HashMap; use std::sync::OnceLock; +use actor_extension_lib::ndslice::PySlice; +use actor_extension_lib::proc::PyActorId; use hyperactor::ActorId; -use monarch_hyperactor::ndslice::PySlice; -use monarch_hyperactor::proc::PyActorId; use monarch_messages::controller::Seq; use monarch_messages::wire_value::func_call_args_to_wire_values; use monarch_messages::worker; diff --git a/monarch_extension/src/debugger.rs b/monarch_extension/src/debugger.rs index 275788c8..197a9404 100644 --- a/monarch_extension/src/debugger.rs +++ b/monarch_extension/src/debugger.rs @@ -8,11 +8,11 @@ use std::sync::Arc; +use actor_extension_lib::proc::InstanceWrapper; +use actor_extension_lib::proc::PyProc; +use actor_extension_lib::proc::PySerialized; +use actor_extension_lib::runtime::signal_safe_block_on; use hyperactor::ActorRef; -use monarch_hyperactor::proc::InstanceWrapper; -use monarch_hyperactor::proc::PyProc; -use monarch_hyperactor::proc::PySerialized; -use monarch_hyperactor::runtime::signal_safe_block_on; use monarch_messages::controller::ControllerActor; use monarch_messages::controller::ControllerMessageClient; use monarch_messages::debugger::DebuggerAction; diff --git a/monarch_extension/src/mesh_controller.rs b/monarch_extension/src/mesh_controller.rs index e3b8affb..9659ff64 100644 --- a/monarch_extension/src/mesh_controller.rs +++ b/monarch_extension/src/mesh_controller.rs @@ -19,6 +19,12 @@ use std::sync::Arc; use std::sync::atomic; use std::sync::atomic::AtomicUsize; +use actor_extension_lib::actor::PythonMessage; +use actor_extension_lib::mailbox::PyPortId; +use actor_extension_lib::ndslice::PySlice; +use actor_extension_lib::proc_mesh::PyProcMesh; +use actor_extension_lib::proc_mesh::TrackedProcMesh; +use actor_extension_lib::runtime::signal_safe_block_on; use async_trait::async_trait; use hyperactor::Actor; use hyperactor::ActorHandle; @@ -35,12 +41,6 @@ use hyperactor_mesh::Mesh; use hyperactor_mesh::actor_mesh::RootActorMesh; use hyperactor_mesh::shared_cell::SharedCell; use hyperactor_mesh::shared_cell::SharedCellRef; -use monarch_hyperactor::actor::PythonMessage; -use monarch_hyperactor::mailbox::PyPortId; -use monarch_hyperactor::ndslice::PySlice; -use monarch_hyperactor::proc_mesh::PyProcMesh; -use monarch_hyperactor::proc_mesh::TrackedProcMesh; -use monarch_hyperactor::runtime::signal_safe_block_on; use monarch_messages::controller::ControllerActor; use monarch_messages::controller::ControllerMessage; use monarch_messages::controller::Seq; diff --git a/monarch_extension/src/simulator_client.rs b/monarch_extension/src/simulator_client.rs index 85657d40..75d8350c 100644 --- a/monarch_extension/src/simulator_client.rs +++ b/monarch_extension/src/simulator_client.rs @@ -8,6 +8,7 @@ #![cfg(feature = "tensor_engine")] +use actor_extension_lib::runtime::signal_safe_block_on; use anyhow::anyhow; use hyperactor::PortId; use hyperactor::attrs::Attrs; @@ -21,7 +22,6 @@ use hyperactor::simnet::OperationalMessage; use hyperactor::simnet::ProxyMessage; use hyperactor::simnet::SpawnMesh; use hyperactor::simnet::TrainingScriptState; -use monarch_hyperactor::runtime::signal_safe_block_on; use monarch_simulator_lib::bootstrap::bootstrap; use pyo3::exceptions::PyRuntimeError; use pyo3::exceptions::PyValueError; diff --git a/monarch_extension/src/tensor_worker.rs b/monarch_extension/src/tensor_worker.rs index 31a9ac4d..fb336ee5 100644 --- a/monarch_extension/src/tensor_worker.rs +++ b/monarch_extension/src/tensor_worker.rs @@ -20,13 +20,13 @@ use std::ops::DerefMut; use std::os::fd::FromRawFd; use std::os::fd::OwnedFd; +use actor_extension_lib::ndslice::PySlice; +use actor_extension_lib::proc::PyActorId; +use actor_extension_lib::runtime::get_tokio_runtime; use anyhow::Result; use clap::Parser; use hyperactor::data::Serialized; use hyperactor::reference::ActorId; -use monarch_hyperactor::ndslice::PySlice; -use monarch_hyperactor::proc::PyActorId; -use monarch_hyperactor::runtime::get_tokio_runtime; use monarch_messages::wire_value::WireValue; use monarch_messages::wire_value::func_call_args_to_wire_values; use monarch_messages::worker::*; diff --git a/monarch_hyperactor/Cargo.toml b/monarch_hyperactor/Cargo.toml deleted file mode 100644 index 1cce78d4..00000000 --- a/monarch_hyperactor/Cargo.toml +++ /dev/null @@ -1,30 +0,0 @@ -# @generated by autocargo from //monarch/monarch_hyperactor:[monarch_hyperactor,process_allocator-oss] - -[package] -name = "monarch_hyperactor" -version = "0.0.0" -authors = ["Meta"] -edition = "2021" -license = "BSD-3-Clause" - -[dependencies] -anyhow = "1.0.98" -async-trait = "0.1.86" -bincode = "1.3.3" -clap = { version = "4.5.38", features = ["derive", "env", "string", "unicode", "wrap_help"] } -erased-serde = "0.3.27" -fbinit = { version = "0.2.0", git = "https://github.com/facebookexperimental/rust-shed.git", branch = "main" } -hyperactor = { version = "0.0.0", path = "../hyperactor" } -hyperactor_mesh = { version = "0.0.0", path = "../hyperactor_mesh" } -hyperactor_multiprocess = { version = "0.0.0", path = "../hyperactor_multiprocess" } -hyperactor_telemetry = { version = "0.0.0", path = "../hyperactor_telemetry" } -inventory = "0.3.8" -monarch_types = { version = "0.0.0", path = "../monarch_types" } -ndslice = { version = "0.0.0", path = "../ndslice" } -pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods"] } -pyo3-async-runtimes = { version = "0.24", features = ["attributes", "tokio-runtime"] } -serde = { version = "1.0.185", features = ["derive", "rc"] } -serde_bytes = "0.11" -thiserror = "2.0.12" -tokio = { version = "1.45.0", features = ["full", "test-util", "tracing"] } -tracing = { version = "0.1.41", features = ["attributes", "valuable"] } diff --git a/monarch_hyperactor/src/lib.rs b/monarch_hyperactor/src/lib.rs deleted file mode 100644 index 294cabb7..00000000 --- a/monarch_hyperactor/src/lib.rs +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#![allow(unsafe_op_in_unsafe_fn)] - -pub mod actor; -pub mod actor_mesh; -pub mod alloc; -pub mod bootstrap; -pub mod channel; -pub mod config; -pub mod mailbox; -pub mod ndslice; -pub mod proc; -pub mod proc_mesh; -pub mod runtime; -pub mod selection; -pub mod shape; diff --git a/monarch_tensor_worker/Cargo.toml b/monarch_tensor_worker/Cargo.toml index 6116e830..9d7c91fa 100644 --- a/monarch_tensor_worker/Cargo.toml +++ b/monarch_tensor_worker/Cargo.toml @@ -8,6 +8,7 @@ edition = "2021" license = "BSD-3-Clause" [dependencies] +actor_extension_lib = { version = "0.0.0", path = "../actor_extension" } anyhow = "1.0.98" async-trait = "0.1.86" bincode = "1.3.3" @@ -19,7 +20,6 @@ hyperactor = { version = "0.0.0", path = "../hyperactor" } hyperactor_mesh = { version = "0.0.0", path = "../hyperactor_mesh" } hyperactor_multiprocess = { version = "0.0.0", path = "../hyperactor_multiprocess" } itertools = "0.14.0" -monarch_hyperactor = { version = "0.0.0", path = "../monarch_hyperactor" } monarch_messages = { version = "0.0.0", path = "../monarch_messages" } monarch_types = { version = "0.0.0", path = "../monarch_types" } ndslice = { version = "0.0.0", path = "../ndslice" } diff --git a/monarch_tensor_worker/src/lib.rs b/monarch_tensor_worker/src/lib.rs index f1438067..eb794e6b 100644 --- a/monarch_tensor_worker/src/lib.rs +++ b/monarch_tensor_worker/src/lib.rs @@ -41,6 +41,8 @@ use std::collections::HashSet; use std::collections::hash_map::Entry; use std::sync::Arc; +use actor_extension_lib::shape::PyPoint; +use actor_extension_lib::shape::PyShape; use anyhow::Context; use anyhow::Result; use anyhow::anyhow; @@ -66,8 +68,6 @@ use hyperactor::forward; use hyperactor::reference::ActorId; use hyperactor_mesh::comm::multicast::CastInfo; use itertools::Itertools; -use monarch_hyperactor::shape::PyPoint; -use monarch_hyperactor::shape::PyShape; use monarch_messages::controller::ControllerActor; use monarch_messages::controller::ControllerMessageClient; use monarch_messages::controller::Seq; diff --git a/monarch_tensor_worker/src/stream.rs b/monarch_tensor_worker/src/stream.rs index 1ee4e7a7..f267aa39 100644 --- a/monarch_tensor_worker/src/stream.rs +++ b/monarch_tensor_worker/src/stream.rs @@ -15,6 +15,7 @@ use std::sync::Arc; use std::sync::OnceLock; use std::time::Duration; +use actor_extension_lib::actor::PythonMessage; use anyhow::Result; use anyhow::anyhow; use anyhow::bail; @@ -36,7 +37,6 @@ use hyperactor::mailbox::Mailbox; use hyperactor::mailbox::OncePortHandle; use hyperactor::mailbox::PortReceiver; use hyperactor::proc::Proc; -use monarch_hyperactor::actor::PythonMessage; use monarch_messages::controller::ControllerMessageClient; use monarch_messages::controller::Seq; use monarch_messages::controller::WorkerError; diff --git a/python/monarch/_monarch/selection/__init__.py b/python/monarch/_monarch/selection/__init__.py index fb4fd5cc..8bc246e6 100644 --- a/python/monarch/_monarch/selection/__init__.py +++ b/python/monarch/_monarch/selection/__init__.py @@ -4,7 +4,7 @@ # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. -from monarch._src.actor._extension.monarch_hyperactor.selection import ( # @manual=//monarch/monarch_extension:monarch_extension +from monarch._src.actor._extension.selection import ( # @manual=//monarch/monarch_extension:monarch_extension Selection, ) diff --git a/python/monarch/_rust_bindings/monarch_extension/client.pyi b/python/monarch/_rust_bindings/monarch_extension/client.pyi index a38a466c..01a3e806 100644 --- a/python/monarch/_rust_bindings/monarch_extension/client.pyi +++ b/python/monarch/_rust_bindings/monarch_extension/client.pyi @@ -8,12 +8,8 @@ from typing import Any, ClassVar, Dict, final, List, NamedTuple, Union from monarch._rust_bindings.monarch_extension.tensor_worker import Ref from monarch._rust_bindings.monarch_messages.debugger import DebuggerActionType -from monarch._src.actor._extension.monarch_hyperactor.proc import ( - ActorId, - Proc, - Serialized, -) -from monarch._src.actor._extension.monarch_hyperactor.shape import Slice as NDSlice +from monarch._src.actor._extension.proc import ActorId, Proc, Serialized +from monarch._src.actor._extension.shape import Slice as NDSlice class Exception: """ diff --git a/python/monarch/_rust_bindings/monarch_extension/controller.pyi b/python/monarch/_rust_bindings/monarch_extension/controller.pyi index 6f6248a5..23ed39e5 100644 --- a/python/monarch/_rust_bindings/monarch_extension/controller.pyi +++ b/python/monarch/_rust_bindings/monarch_extension/controller.pyi @@ -9,9 +9,9 @@ from typing import Any, final, List, Optional, Tuple, Union from monarch._rust_bindings.monarch_extension.tensor_worker import Ref, WorkerMessage -from monarch._src.actor._extension.monarch_hyperactor.proc import Serialized +from monarch._src.actor._extension.proc import Serialized -from monarch._src.actor._extension.monarch_hyperactor.shape import Slice +from monarch._src.actor._extension.shape import Slice @final class Node: diff --git a/python/monarch/_rust_bindings/monarch_extension/debugger.pyi b/python/monarch/_rust_bindings/monarch_extension/debugger.pyi index 50284854..138b12ea 100644 --- a/python/monarch/_rust_bindings/monarch_extension/debugger.pyi +++ b/python/monarch/_rust_bindings/monarch_extension/debugger.pyi @@ -11,7 +11,7 @@ from monarch._rust_bindings.monarch_messages.debugger import ( DebuggerActionType, ) -from monarch._src.actor._extension.monarch_hyperactor.proc import Serialized +from monarch._src.actor._extension.proc import Serialized @final class DebuggerMessage: diff --git a/python/monarch/_rust_bindings/monarch_extension/mesh_controller.pyi b/python/monarch/_rust_bindings/monarch_extension/mesh_controller.pyi index 7f2b70d3..e12d0373 100644 --- a/python/monarch/_rust_bindings/monarch_extension/mesh_controller.pyi +++ b/python/monarch/_rust_bindings/monarch_extension/mesh_controller.pyi @@ -8,11 +8,11 @@ from traceback import FrameSummary from typing import List, NamedTuple, Sequence, Tuple, Union from monarch._rust_bindings.monarch_extension import client -from monarch._src.actor._extension.monarch_hyperactor.mailbox import PortId -from monarch._src.actor._extension.monarch_hyperactor.proc import ActorId -from monarch._src.actor._extension.monarch_hyperactor.proc_mesh import ProcMesh +from monarch._src.actor._extension.mailbox import PortId +from monarch._src.actor._extension.proc import ActorId +from monarch._src.actor._extension.proc_mesh import ProcMesh -from monarch._src.actor._extension.monarch_hyperactor.shape import Slice as NDSlice +from monarch._src.actor._extension.shape import Slice as NDSlice class _Controller: def __init__(self) -> None: ... diff --git a/python/monarch/_rust_bindings/monarch_extension/tensor_worker.pyi b/python/monarch/_rust_bindings/monarch_extension/tensor_worker.pyi index a84806a5..6bcc5314 100644 --- a/python/monarch/_rust_bindings/monarch_extension/tensor_worker.pyi +++ b/python/monarch/_rust_bindings/monarch_extension/tensor_worker.pyi @@ -7,8 +7,8 @@ from typing import Callable, final, Optional, Sequence, Tuple import torch -from monarch._src.actor._extension.monarch_hyperactor.proc import ActorId -from monarch._src.actor._extension.monarch_hyperactor.shape import Slice +from monarch._src.actor._extension.proc import ActorId +from monarch._src.actor._extension.shape import Slice @final class Ref: diff --git a/python/monarch/_rust_bindings/old.pyi b/python/monarch/_rust_bindings/old.pyi index f045ee7a..8fec586c 100644 --- a/python/monarch/_rust_bindings/old.pyi +++ b/python/monarch/_rust_bindings/old.pyi @@ -8,11 +8,11 @@ from typing import Dict, final, List, Optional, Protocol, Type -from monarch._src.actor._extension.monarch_hyperactor.alloc import Alloc, AllocSpec +from monarch._src.actor._extension.alloc import Alloc, AllocSpec -from monarch._src.actor._extension.monarch_hyperactor.selection import Selection +from monarch._src.actor._extension.selection import Selection -from monarch._src.actor._extension.monarch_hyperactor.shape import Shape +from monarch._src.actor._extension.shape import Shape def init_proc( *, diff --git a/python/monarch/_src/actor/_extension/monarch_hyperactor/actor.pyi b/python/monarch/_src/actor/_extension/actor.pyi similarity index 94% rename from python/monarch/_src/actor/_extension/monarch_hyperactor/actor.pyi rename to python/monarch/_src/actor/_extension/actor.pyi index c41a152e..e104039a 100644 --- a/python/monarch/_src/actor/_extension/monarch_hyperactor/actor.pyi +++ b/python/monarch/_src/actor/_extension/actor.pyi @@ -10,17 +10,9 @@ import abc from typing import final, List, Optional, Protocol -from monarch._src.actor._extension.monarch_hyperactor.mailbox import ( - Mailbox, - OncePortRef, - PortRef, -) -from monarch._src.actor._extension.monarch_hyperactor.proc import ( - ActorId, - Proc, - Serialized, -) -from monarch._src.actor._extension.monarch_hyperactor.shape import Shape +from monarch._src.actor._extension.mailbox import Mailbox, OncePortRef, PortRef +from monarch._src.actor._extension.proc import ActorId, Proc, Serialized +from monarch._src.actor._extension.shape import Shape @final class PickledMessage: diff --git a/python/monarch/_src/actor/_extension/monarch_hyperactor/actor_mesh.pyi b/python/monarch/_src/actor/_extension/actor_mesh.pyi similarity index 73% rename from python/monarch/_src/actor/_extension/monarch_hyperactor/actor_mesh.pyi rename to python/monarch/_src/actor/_extension/actor_mesh.pyi index db8df5e0..635499a4 100644 --- a/python/monarch/_src/actor/_extension/monarch_hyperactor/actor_mesh.pyi +++ b/python/monarch/_src/actor/_extension/actor_mesh.pyi @@ -8,11 +8,11 @@ from typing import final -from monarch._src.actor._extension.monarch_hyperactor.actor import PythonMessage -from monarch._src.actor._extension.monarch_hyperactor.mailbox import Mailbox -from monarch._src.actor._extension.monarch_hyperactor.proc import ActorId -from monarch._src.actor._extension.monarch_hyperactor.selection import Selection -from monarch._src.actor._extension.monarch_hyperactor.shape import Shape +from monarch._src.actor._extension.actor import PythonMessage +from monarch._src.actor._extension.mailbox import Mailbox +from monarch._src.actor._extension.proc import ActorId +from monarch._src.actor._extension.selection import Selection +from monarch._src.actor._extension.shape import Shape @final class PythonActorMesh: diff --git a/python/monarch/_src/actor/_extension/monarch_hyperactor/alloc.pyi b/python/monarch/_src/actor/_extension/alloc.pyi similarity index 100% rename from python/monarch/_src/actor/_extension/monarch_hyperactor/alloc.pyi rename to python/monarch/_src/actor/_extension/alloc.pyi diff --git a/python/monarch/_src/actor/_extension/monarch_hyperactor/bootstrap.pyi b/python/monarch/_src/actor/_extension/bootstrap.pyi similarity index 100% rename from python/monarch/_src/actor/_extension/monarch_hyperactor/bootstrap.pyi rename to python/monarch/_src/actor/_extension/bootstrap.pyi diff --git a/python/monarch/_src/actor/_extension/monarch_hyperactor/channel.pyi b/python/monarch/_src/actor/_extension/channel.pyi similarity index 100% rename from python/monarch/_src/actor/_extension/monarch_hyperactor/channel.pyi rename to python/monarch/_src/actor/_extension/channel.pyi diff --git a/python/monarch/_src/actor/_extension/code_sync.pyi b/python/monarch/_src/actor/_extension/code_sync.pyi index bc6d6dce..a820555a 100644 --- a/python/monarch/_src/actor/_extension/code_sync.pyi +++ b/python/monarch/_src/actor/_extension/code_sync.pyi @@ -7,9 +7,9 @@ from pathlib import Path from typing import final -from monarch._src.actor._extension.monarch_hyperactor.proc_mesh import ProcMesh +from monarch._src.actor._extension.proc_mesh import ProcMesh -from monarch._src.actor._extension.monarch_hyperactor.shape import Shape +from monarch._src.actor._extension.shape import Shape class WorkspaceLocation: """ diff --git a/python/monarch/_src/actor/_extension/monarch_hyperactor/mailbox.pyi b/python/monarch/_src/actor/_extension/mailbox.pyi similarity index 96% rename from python/monarch/_src/actor/_extension/monarch_hyperactor/mailbox.pyi rename to python/monarch/_src/actor/_extension/mailbox.pyi index 0c057587..346dc2e6 100644 --- a/python/monarch/_src/actor/_extension/monarch_hyperactor/mailbox.pyi +++ b/python/monarch/_src/actor/_extension/mailbox.pyi @@ -8,14 +8,14 @@ from typing import final, Generic, Protocol -from monarch._src.actor._extension.monarch_hyperactor.actor import ( +from monarch._src.actor._extension.actor import ( PythonMessage, UndeliverableMessageEnvelope, ) -from monarch._src.actor._extension.monarch_hyperactor.proc import ActorId +from monarch._src.actor._extension.proc import ActorId -from monarch._src.actor._extension.monarch_hyperactor.shape import Shape +from monarch._src.actor._extension.shape import Shape @final class PortId: diff --git a/python/monarch/_src/actor/_extension/monarch_hyperactor/proc.pyi b/python/monarch/_src/actor/_extension/proc.pyi similarity index 95% rename from python/monarch/_src/actor/_extension/monarch_hyperactor/proc.pyi rename to python/monarch/_src/actor/_extension/proc.pyi index 42f01c94..0d75e9d6 100644 --- a/python/monarch/_src/actor/_extension/monarch_hyperactor/proc.pyi +++ b/python/monarch/_src/actor/_extension/proc.pyi @@ -8,11 +8,8 @@ from typing import final, Optional, Type -from monarch._src.actor._extension.monarch_hyperactor.actor import ( - Actor, - PythonActorHandle, -) -from monarch._src.actor._extension.monarch_hyperactor.mailbox import Mailbox +from monarch._src.actor._extension.actor import Actor, PythonActorHandle +from monarch._src.actor._extension.mailbox import Mailbox def init_proc( *, diff --git a/python/monarch/_src/actor/_extension/monarch_hyperactor/proc_mesh.pyi b/python/monarch/_src/actor/_extension/proc_mesh.pyi similarity index 87% rename from python/monarch/_src/actor/_extension/monarch_hyperactor/proc_mesh.pyi rename to python/monarch/_src/actor/_extension/proc_mesh.pyi index aa072dd8..a296573e 100644 --- a/python/monarch/_src/actor/_extension/monarch_hyperactor/proc_mesh.pyi +++ b/python/monarch/_src/actor/_extension/proc_mesh.pyi @@ -8,12 +8,12 @@ from typing import AsyncIterator, final, Type -from monarch._src.actor._extension.monarch_hyperactor.actor import Actor -from monarch._src.actor._extension.monarch_hyperactor.actor_mesh import PythonActorMesh +from monarch._src.actor._extension.actor import Actor +from monarch._src.actor._extension.actor_mesh import PythonActorMesh -from monarch._src.actor._extension.monarch_hyperactor.alloc import Alloc -from monarch._src.actor._extension.monarch_hyperactor.mailbox import Mailbox -from monarch._src.actor._extension.monarch_hyperactor.shape import Shape +from monarch._src.actor._extension.alloc import Alloc +from monarch._src.actor._extension.mailbox import Mailbox +from monarch._src.actor._extension.shape import Shape @final class ProcMesh: diff --git a/python/monarch/_src/actor/_extension/monarch_hyperactor/runtime.pyi b/python/monarch/_src/actor/_extension/runtime.pyi similarity index 100% rename from python/monarch/_src/actor/_extension/monarch_hyperactor/runtime.pyi rename to python/monarch/_src/actor/_extension/runtime.pyi diff --git a/python/monarch/_src/actor/_extension/monarch_hyperactor/selection.pyi b/python/monarch/_src/actor/_extension/selection.pyi similarity index 100% rename from python/monarch/_src/actor/_extension/monarch_hyperactor/selection.pyi rename to python/monarch/_src/actor/_extension/selection.pyi diff --git a/python/monarch/_src/actor/_extension/monarch_hyperactor/shape.pyi b/python/monarch/_src/actor/_extension/shape.pyi similarity index 100% rename from python/monarch/_src/actor/_extension/monarch_hyperactor/shape.pyi rename to python/monarch/_src/actor/_extension/shape.pyi diff --git a/python/monarch/_src/actor/actor_mesh.py b/python/monarch/_src/actor/actor_mesh.py index b1b5fb8e..fef04bc2 100644 --- a/python/monarch/_src/actor/actor_mesh.py +++ b/python/monarch/_src/actor/actor_mesh.py @@ -38,23 +38,17 @@ TypeVar, ) -from monarch._src.actor._extension.monarch_hyperactor.actor import ( - PanicFlag, - PythonMessage, -) -from monarch._src.actor._extension.monarch_hyperactor.actor_mesh import PythonActorMesh -from monarch._src.actor._extension.monarch_hyperactor.mailbox import ( +from monarch._src.actor._extension.actor import PanicFlag, PythonMessage +from monarch._src.actor._extension.actor_mesh import PythonActorMesh +from monarch._src.actor._extension.mailbox import ( Mailbox, OncePortReceiver, OncePortRef, PortReceiver as HyPortReceiver, PortRef, ) -from monarch._src.actor._extension.monarch_hyperactor.proc import ActorId -from monarch._src.actor._extension.monarch_hyperactor.shape import ( - Point as HyPoint, - Shape, -) +from monarch._src.actor._extension.proc import ActorId +from monarch._src.actor._extension.shape import Point as HyPoint, Shape from monarch._src.actor._extension.telemetry import enter_span, exit_span diff --git a/python/monarch/_src/actor/allocator.py b/python/monarch/_src/actor/allocator.py index 116b3648..7d462070 100644 --- a/python/monarch/_src/actor/allocator.py +++ b/python/monarch/_src/actor/allocator.py @@ -10,7 +10,7 @@ import logging from typing import final, Optional -from monarch._src.actor._extension.monarch_hyperactor.alloc import ( +from monarch._src.actor._extension.alloc import ( Alloc, AllocSpec, LocalAllocatorBase, @@ -73,7 +73,7 @@ class RemoteAllocInitializer(abc.ABC): """Subclass-able Python interface for `hyperactor_mesh::alloc::remoteprocess:RemoteProcessAllocInitializer`. NOTE: changes to method signatures of this class must be made to the call-site at - `PyRemoteProcessAllocInitializer.py_initialize_alloc()` in `monarch/monarch_hyperactor/src/alloc.rs` + `PyRemoteProcessAllocInitializer.py_initialize_alloc()` in `monarch/actor_extension/src/alloc.rs` """ @abc.abstractmethod diff --git a/python/monarch/_src/actor/bootstrap_main.py b/python/monarch/_src/actor/bootstrap_main.py index a5f50898..68474205 100644 --- a/python/monarch/_src/actor/bootstrap_main.py +++ b/python/monarch/_src/actor/bootstrap_main.py @@ -22,9 +22,7 @@ async def main(): - from monarch._src.actor._extension.monarch_hyperactor.bootstrap import ( - bootstrap_main, - ) + from monarch._src.actor._extension.bootstrap import bootstrap_main await bootstrap_main() diff --git a/python/monarch/_src/actor/debugger.py b/python/monarch/_src/actor/debugger.py index 31d0dcbb..1b653bfd 100644 --- a/python/monarch/_src/actor/debugger.py +++ b/python/monarch/_src/actor/debugger.py @@ -10,7 +10,7 @@ from dataclasses import dataclass from typing import Dict, List, Tuple, Union -from monarch._src.actor._extension.monarch_hyperactor.proc import ActorId +from monarch._src.actor._extension.proc import ActorId from monarch._src.actor.actor_mesh import Actor, ActorMeshRef, endpoint from monarch._src.actor.pdb_wrapper import DebuggerWrite from monarch._src.actor.proc_mesh import local_proc_mesh diff --git a/python/monarch/_src/actor/pdb_wrapper.py b/python/monarch/_src/actor/pdb_wrapper.py index a79d995c..19273151 100644 --- a/python/monarch/_src/actor/pdb_wrapper.py +++ b/python/monarch/_src/actor/pdb_wrapper.py @@ -14,7 +14,7 @@ from typing import Dict, TYPE_CHECKING -from monarch._src.actor._extension.monarch_hyperactor.proc import ActorId +from monarch._src.actor._extension.proc import ActorId if TYPE_CHECKING: from monarch._src.actor.debugger import DebugClient diff --git a/python/monarch/_src/actor/proc_mesh.py b/python/monarch/_src/actor/proc_mesh.py index 66872879..06fabad1 100644 --- a/python/monarch/_src/actor/proc_mesh.py +++ b/python/monarch/_src/actor/proc_mesh.py @@ -22,17 +22,17 @@ TypeVar, ) -from monarch._src.actor._extension.monarch_hyperactor.alloc import ( # @manual=//monarch/actor_extension:actor_extension +from monarch._src.actor._extension.alloc import ( # @manual=//monarch/actor_extension:actor_extension Alloc, AllocConstraints, AllocSpec, ) -from monarch._src.actor._extension.monarch_hyperactor.mailbox import Mailbox -from monarch._src.actor._extension.monarch_hyperactor.proc_mesh import ( +from monarch._src.actor._extension.mailbox import Mailbox +from monarch._src.actor._extension.proc_mesh import ( ProcMesh as HyProcMesh, ProcMeshMonitor, ) -from monarch._src.actor._extension.monarch_hyperactor.shape import Shape, Slice +from monarch._src.actor._extension.shape import Shape, Slice from monarch._src.actor.actor_mesh import _Actor, _ActorMeshRefImpl, Actor, ActorMeshRef from monarch._src.actor.allocator import LocalAllocator, ProcessAllocator from monarch._src.actor.code_sync import RsyncMeshClient, WorkspaceLocation diff --git a/python/monarch/_src/actor/shape.py b/python/monarch/_src/actor/shape.py index 0e26fdc0..2178a23b 100644 --- a/python/monarch/_src/actor/shape.py +++ b/python/monarch/_src/actor/shape.py @@ -10,7 +10,7 @@ from typing import Dict, Generator, Sequence, Tuple, Union -from monarch._src.actor._extension.monarch_hyperactor.shape import Shape, Slice +from monarch._src.actor._extension.shape import Shape, Slice from typing_extensions import Self diff --git a/python/monarch/common/invocation.py b/python/monarch/common/invocation.py index 1a01e492..f10bf7a0 100644 --- a/python/monarch/common/invocation.py +++ b/python/monarch/common/invocation.py @@ -8,7 +8,7 @@ import traceback from typing import Any, List, Optional, Tuple -from monarch._src.actor._extension.monarch_hyperactor.proc import ( # @manual=//monarch/monarch_extension:monarch_extension +from monarch._src.actor._extension.proc import ( # @manual=//monarch/monarch_extension:monarch_extension ActorId, ) diff --git a/python/monarch/common/selection.py b/python/monarch/common/selection.py index 5d7d4c77..4b373e01 100644 --- a/python/monarch/common/selection.py +++ b/python/monarch/common/selection.py @@ -4,6 +4,6 @@ # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. -from monarch._src.actor._extension.monarch_hyperactor.selection import Selection +from monarch._src.actor._extension.selection import Selection __all__ = ["Selection"] diff --git a/python/monarch/controller/controller.py b/python/monarch/controller/controller.py index a591c6d8..61084ec7 100644 --- a/python/monarch/controller/controller.py +++ b/python/monarch/controller/controller.py @@ -15,7 +15,7 @@ WorldState, ) -from monarch._src.actor._extension.monarch_hyperactor.proc import ( # @manual=//monarch/monarch_extension:monarch_extension +from monarch._src.actor._extension.proc import ( # @manual=//monarch/monarch_extension:monarch_extension ActorId, ) diff --git a/python/monarch/controller/history.py b/python/monarch/controller/history.py index 61ca7508..294e054f 100644 --- a/python/monarch/controller/history.py +++ b/python/monarch/controller/history.py @@ -8,7 +8,7 @@ from collections import deque from typing import Generator, Sequence, TYPE_CHECKING -from monarch._src.actor._extension.monarch_hyperactor.proc import ( # @manual=//monarch/monarch_extension:monarch_extension +from monarch._src.actor._extension.proc import ( # @manual=//monarch/monarch_extension:monarch_extension ActorId, ) diff --git a/python/monarch/controller/rust_backend/controller.py b/python/monarch/controller/rust_backend/controller.py index 919d7fb3..4e68cc08 100644 --- a/python/monarch/controller/rust_backend/controller.py +++ b/python/monarch/controller/rust_backend/controller.py @@ -25,7 +25,7 @@ ) from monarch._rust_bindings.monarch_messages.debugger import DebuggerAction -from monarch._src.actor._extension.monarch_hyperactor.proc import ( # @manual=//monarch/monarch_extension:monarch_extension +from monarch._src.actor._extension.proc import ( # @manual=//monarch/monarch_extension:monarch_extension ActorId, Proc, ) diff --git a/python/monarch/mesh_controller.py b/python/monarch/mesh_controller.py index 201d9c95..03bcfbec 100644 --- a/python/monarch/mesh_controller.py +++ b/python/monarch/mesh_controller.py @@ -30,8 +30,8 @@ WorldState, ) from monarch._rust_bindings.monarch_extension.mesh_controller import _Controller -from monarch._src.actor._extension.monarch_hyperactor.mailbox import Mailbox -from monarch._src.actor._extension.monarch_hyperactor.proc import ( # @manual=//monarch/monarch_extension:monarch_extension +from monarch._src.actor._extension.mailbox import Mailbox +from monarch._src.actor._extension.proc import ( # @manual=//monarch/monarch_extension:monarch_extension ActorId, ) from monarch._src.actor.actor_mesh import Port, PortTuple @@ -45,12 +45,10 @@ from monarch.tensor_worker_main import _set_trace if TYPE_CHECKING: - from monarch._src.actor._extension.monarch_hyperactor.proc_mesh import ( - ProcMesh as HyProcMesh, - ) + from monarch._src.actor._extension.proc_mesh import ProcMesh as HyProcMesh from monarch.actor import ProcMesh -from monarch._src.actor._extension.monarch_hyperactor.shape import Point +from monarch._src.actor._extension.shape import Point from monarch.common.client import Client from monarch.common.controller_api import LogMessage, MessageResult diff --git a/python/monarch/rdma.py b/python/monarch/rdma.py index cad4131a..d23426bf 100644 --- a/python/monarch/rdma.py +++ b/python/monarch/rdma.py @@ -11,7 +11,7 @@ import torch -from monarch._src.actor._extension.monarch_hyperactor.proc import ActorId +from monarch._src.actor._extension.proc import ActorId from monarch._src.actor.actor_mesh import ( _ActorMeshRefImpl, Actor, diff --git a/python/monarch/rust_backend_mesh.py b/python/monarch/rust_backend_mesh.py index 260e26f1..254d4384 100644 --- a/python/monarch/rust_backend_mesh.py +++ b/python/monarch/rust_backend_mesh.py @@ -15,7 +15,7 @@ SystemSnapshotFilter, ) -from monarch._src.actor._extension.monarch_hyperactor.proc import ( # @manual=//monarch/monarch_extension:monarch_extension +from monarch._src.actor._extension.proc import ( # @manual=//monarch/monarch_extension:monarch_extension ActorId, init_proc, Proc, diff --git a/python/monarch/rust_local_mesh.py b/python/monarch/rust_local_mesh.py index 9b9cf2cf..80f58334 100644 --- a/python/monarch/rust_local_mesh.py +++ b/python/monarch/rust_local_mesh.py @@ -50,7 +50,7 @@ WorkerServerResponse, ) -from monarch._src.actor._extension.monarch_hyperactor.proc import ( # @manual=//monarch/monarch_extension:monarch_extension +from monarch._src.actor._extension.proc import ( # @manual=//monarch/monarch_extension:monarch_extension ActorId, ) diff --git a/python/monarch/sim_mesh.py b/python/monarch/sim_mesh.py index ffd447fb..092e0d41 100644 --- a/python/monarch/sim_mesh.py +++ b/python/monarch/sim_mesh.py @@ -35,7 +35,7 @@ SimulatorClient, ) -from monarch._src.actor._extension.monarch_hyperactor.proc import ( # @manual=//monarch/monarch_extension:monarch_extension +from monarch._src.actor._extension.proc import ( # @manual=//monarch/monarch_extension:monarch_extension ActorId, init_proc, Proc, diff --git a/python/monarch/simulator/mock_controller.py b/python/monarch/simulator/mock_controller.py index ab1db332..a6db62a2 100644 --- a/python/monarch/simulator/mock_controller.py +++ b/python/monarch/simulator/mock_controller.py @@ -22,7 +22,7 @@ from monarch._rust_bindings.monarch_extension.client import ( # @manual=//monarch/monarch_extension:monarch_extension WorldState, ) -from monarch._src.actor._extension.monarch_hyperactor.proc import ( # @manual=//monarch/monarch_extension:monarch_extension +from monarch._src.actor._extension.proc import ( # @manual=//monarch/monarch_extension:monarch_extension ActorId, ) from monarch._src.actor.shape import iter_ranks, NDSlice, Slices as Ranks diff --git a/python/monarch/simulator/simulator.py b/python/monarch/simulator/simulator.py index f6568b7f..d66c2754 100644 --- a/python/monarch/simulator/simulator.py +++ b/python/monarch/simulator/simulator.py @@ -40,7 +40,7 @@ import numpy as np import torch -from monarch._src.actor._extension.monarch_hyperactor.proc import ( # @manual=//monarch/monarch_extension:monarch_extension +from monarch._src.actor._extension.proc import ( # @manual=//monarch/monarch_extension:monarch_extension ActorId, ) from monarch._src.actor.shape import iter_ranks, NDSlice diff --git a/python/monarch/tools/mesh_spec.py b/python/monarch/tools/mesh_spec.py index 7fd32a49..e35ec697 100644 --- a/python/monarch/tools/mesh_spec.py +++ b/python/monarch/tools/mesh_spec.py @@ -34,7 +34,7 @@ class MeshSpec: num_hosts: int host_type: str = _UNSET_STR gpus: int = _UNSET_INT - # NOTE: using str over monarch._src.actor._extension.monarch_hyperactor.channel.ChannelTransport enum + # NOTE: using str over monarch._src.actor._extension.channel.ChannelTransport enum # b/c the rust binding doesn't have Python enum semantics, hence doesn't serialize well transport: str = "tcp" port: int = DEFAULT_REMOTE_ALLOCATOR_PORT diff --git a/python/tests/_monarch/test_actor.py b/python/tests/_monarch/test_actor.py index 8b36a998..b64d91f3 100644 --- a/python/tests/_monarch/test_actor.py +++ b/python/tests/_monarch/test_actor.py @@ -8,7 +8,7 @@ import time -from monarch._src.actor._extension.monarch_hyperactor.actor import PythonMessage +from monarch._src.actor._extension.actor import PythonMessage def test_python_message() -> None: diff --git a/python/tests/_monarch/test_client.py b/python/tests/_monarch/test_client.py index ffd983a5..6d101269 100644 --- a/python/tests/_monarch/test_client.py +++ b/python/tests/_monarch/test_client.py @@ -11,7 +11,7 @@ import torch from monarch._rust_bindings.monarch_extension import client -from monarch._src.actor._extension.monarch_hyperactor.proc import ActorId +from monarch._src.actor._extension.proc import ActorId from pyre_extensions import none_throws diff --git a/python/tests/_monarch/test_controller.py b/python/tests/_monarch/test_controller.py index 4080076e..3072cf11 100644 --- a/python/tests/_monarch/test_controller.py +++ b/python/tests/_monarch/test_controller.py @@ -12,7 +12,7 @@ controller, tensor_worker, ) -from monarch._src.actor._extension.monarch_hyperactor import shape +from monarch._src.actor._extension import shape class TestController(TestCase): diff --git a/python/tests/_monarch/test_hyperactor.py b/python/tests/_monarch/test_hyperactor.py index 25631f13..2c9c5ec6 100644 --- a/python/tests/_monarch/test_hyperactor.py +++ b/python/tests/_monarch/test_hyperactor.py @@ -13,19 +13,16 @@ import monarch -from monarch._src.actor._extension.monarch_hyperactor.actor import ( - PanicFlag, - PythonMessage, -) +from monarch._src.actor._extension.actor import PanicFlag, PythonMessage -from monarch._src.actor._extension.monarch_hyperactor.alloc import ( # @manual=//monarch/monarch_extension:monarch_extension +from monarch._src.actor._extension.alloc import ( # @manual=//monarch/monarch_extension:monarch_extension AllocConstraints, AllocSpec, ) -from monarch._src.actor._extension.monarch_hyperactor.mailbox import Mailbox -from monarch._src.actor._extension.monarch_hyperactor.proc import ActorId -from monarch._src.actor._extension.monarch_hyperactor.proc_mesh import ProcMesh -from monarch._src.actor._extension.monarch_hyperactor.shape import Shape +from monarch._src.actor._extension.mailbox import Mailbox +from monarch._src.actor._extension.proc import ActorId +from monarch._src.actor._extension.proc_mesh import ProcMesh +from monarch._src.actor._extension.shape import Shape class MyActor: diff --git a/python/tests/_monarch/test_mailbox.py b/python/tests/_monarch/test_mailbox.py index 60f66e2c..b1a6e0f2 100644 --- a/python/tests/_monarch/test_mailbox.py +++ b/python/tests/_monarch/test_mailbox.py @@ -12,24 +12,14 @@ import monarch -from monarch._src.actor._extension.monarch_hyperactor.actor import ( - PanicFlag, - PythonMessage, -) - -from monarch._src.actor._extension.monarch_hyperactor.alloc import ( - AllocConstraints, - AllocSpec, -) - -from monarch._src.actor._extension.monarch_hyperactor.mailbox import ( - Mailbox, - PortReceiver, - PortRef, -) -from monarch._src.actor._extension.monarch_hyperactor.proc_mesh import ProcMesh -from monarch._src.actor._extension.monarch_hyperactor.selection import Selection -from monarch._src.actor._extension.monarch_hyperactor.shape import Shape +from monarch._src.actor._extension.actor import PanicFlag, PythonMessage + +from monarch._src.actor._extension.alloc import AllocConstraints, AllocSpec + +from monarch._src.actor._extension.mailbox import Mailbox, PortReceiver, PortRef +from monarch._src.actor._extension.proc_mesh import ProcMesh +from monarch._src.actor._extension.selection import Selection +from monarch._src.actor._extension.shape import Shape S = TypeVar("S") U = TypeVar("U") diff --git a/python/tests/_monarch/test_ndslice.py b/python/tests/_monarch/test_ndslice.py index 5757ac8e..aa30301e 100644 --- a/python/tests/_monarch/test_ndslice.py +++ b/python/tests/_monarch/test_ndslice.py @@ -10,9 +10,9 @@ import random from unittest import TestCase -from monarch._src.actor._extension.monarch_hyperactor.selection import Selection +from monarch._src.actor._extension.selection import Selection -from monarch._src.actor._extension.monarch_hyperactor.shape import Shape, Slice +from monarch._src.actor._extension.shape import Shape, Slice class TestNdslice(TestCase): diff --git a/python/tests/_monarch/test_worker.py b/python/tests/_monarch/test_worker.py index 38827469..8a85aad5 100644 --- a/python/tests/_monarch/test_worker.py +++ b/python/tests/_monarch/test_worker.py @@ -13,7 +13,7 @@ import cloudpickle from monarch._rust_bindings.monarch_extension import tensor_worker -from monarch._src.actor._extension.monarch_hyperactor import shape +from monarch._src.actor._extension import shape from pyre_extensions import none_throws diff --git a/python/tests/sleep_binary.py b/python/tests/sleep_binary.py index ab9f2973..0f8c3261 100644 --- a/python/tests/sleep_binary.py +++ b/python/tests/sleep_binary.py @@ -14,7 +14,7 @@ import sys -from monarch._src.actor._extension.monarch_hyperactor.runtime import ( # @manual +from monarch._src.actor._extension.runtime import ( # @manual sleep_indefinitely_for_unit_tests, ) diff --git a/python/tests/test_actor_error.py b/python/tests/test_actor_error.py index add0fc21..c033417a 100644 --- a/python/tests/test_actor_error.py +++ b/python/tests/test_actor_error.py @@ -9,7 +9,7 @@ import subprocess import pytest -from monarch._src.actor._extension.monarch_hyperactor.proc_mesh import ProcEvent +from monarch._src.actor._extension.proc_mesh import ProcEvent from monarch.actor import Actor, ActorError, endpoint, local_proc_mesh, proc_mesh diff --git a/python/tests/test_alloc.py b/python/tests/test_alloc.py index d90a36c3..9b8bc943 100644 --- a/python/tests/test_alloc.py +++ b/python/tests/test_alloc.py @@ -9,7 +9,7 @@ from unittest import IsolatedAsyncioTestCase from monarch import ProcessAllocator -from monarch._src.actor._extension.monarch_hyperactor.alloc import ( # @manual=//monarch/monarch_extension:monarch_extension +from monarch._src.actor._extension.alloc import ( # @manual=//monarch/monarch_extension:monarch_extension AllocConstraints, AllocSpec, ) diff --git a/python/tests/test_allocator.py b/python/tests/test_allocator.py index c18680c0..d33dd223 100644 --- a/python/tests/test_allocator.py +++ b/python/tests/test_allocator.py @@ -24,14 +24,8 @@ import torch.distributed as dist import torch.nn.functional as F -from monarch._src.actor._extension.monarch_hyperactor.alloc import ( - AllocConstraints, - AllocSpec, -) -from monarch._src.actor._extension.monarch_hyperactor.channel import ( - ChannelAddr, - ChannelTransport, -) +from monarch._src.actor._extension.alloc import AllocConstraints, AllocSpec +from monarch._src.actor._extension.channel import ChannelAddr, ChannelTransport from monarch._src.actor.allocator import ( ALLOC_LABEL_PROC_MESH_NAME, RemoteAllocator, diff --git a/python/tests/test_future.py b/python/tests/test_future.py index e2dc9847..6fa94b39 100644 --- a/python/tests/test_future.py +++ b/python/tests/test_future.py @@ -10,7 +10,7 @@ import pytest from monarch import Future, RemoteException -from monarch._src.actor._extension.monarch_hyperactor.proc import ( # @manual=//monarch/monarch_extension:monarch_extension +from monarch._src.actor._extension.proc import ( # @manual=//monarch/monarch_extension:monarch_extension ActorId, ) from monarch.common import future