Skip to content

Commit c85f6cf

Browse files
suofacebook-github-bot
authored andcommitted
Revert D77847588: add actor_extension
Differential Revision: D77847588 Original commit changeset: ec1f4bfba9ec Original Phabricator Diff: D77847588 fbshipit-source-id: 87f1e8849535e0f04917f230f3e3b3b1163e0ea9
1 parent 1e06a7c commit c85f6cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+251
-480
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[workspace]
22
resolver = "2"
33
members = [
4-
"actor_extension",
54
"controller",
65
"hyper",
76
"hyperactor",

actor_extension/Cargo.toml

Lines changed: 0 additions & 26 deletions
This file was deleted.

actor_extension/src/lib.rs

Lines changed: 0 additions & 117 deletions
This file was deleted.

hyperactor_extension/src/alloc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use pyo3::types::PyDict;
2929
/// It ensures that the Alloc is only used once (i.e. moved) in rust.
3030
#[pyclass(
3131
name = "Alloc",
32-
module = "monarch._src.actor._extension.hyperactor_extension.alloc"
32+
module = "monarch._rust_bindings.hyperactor_extension.alloc"
3333
)]
3434
pub struct PyAlloc {
3535
pub inner: Arc<Mutex<Option<PyAllocWrapper>>>,
@@ -91,7 +91,7 @@ impl Alloc for PyAllocWrapper {
9191

9292
#[pyclass(
9393
name = "AllocConstraints",
94-
module = "monarch._src.actor._extension.hyperactor_extension.alloc"
94+
module = "monarch._rust_bindings.hyperactor_extension.alloc"
9595
)]
9696
pub struct PyAllocConstraints {
9797
inner: AllocConstraints,
@@ -113,7 +113,7 @@ impl PyAllocConstraints {
113113

114114
#[pyclass(
115115
name = "AllocSpec",
116-
module = "monarch._src.actor._extension.hyperactor_extension.alloc"
116+
module = "monarch._rust_bindings.hyperactor_extension.alloc"
117117
)]
118118
pub struct PyAllocSpec {
119119
pub inner: AllocSpec,

hyperactor_extension/src/telemetry.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub fn use_sim_clock() -> PyResult<()> {
113113
#[pyclass(
114114
unsendable,
115115
subclass,
116-
module = "monarch._src.actor._extension.hyperactor_extension.telemetry"
116+
module = "monarch._rust_bindings.hyperactor_extension.telemetry"
117117
)]
118118
struct PySpan {
119119
span: tracing::span::EnteredSpan,
@@ -142,43 +142,43 @@ pub fn register_python_bindings(module: &Bound<'_, PyModule>) -> PyResult<()> {
142142
let f = wrap_pyfunction!(forward_to_tracing, module)?;
143143
f.setattr(
144144
"__module__",
145-
"monarch._src.actor._extension.hyperactor_extension.telemetry",
145+
"monarch._rust_bindings.hyperactor_extension.telemetry",
146146
)?;
147147
module.add_function(f)?;
148148

149149
// Register the span-related functions
150150
let enter_span_fn = wrap_pyfunction!(enter_span, module)?;
151151
enter_span_fn.setattr(
152152
"__module__",
153-
"monarch._src.actor._extension.hyperactor_extension.telemetry",
153+
"monarch._rust_bindings.hyperactor_extension.telemetry",
154154
)?;
155155
module.add_function(enter_span_fn)?;
156156

157157
let exit_span_fn = wrap_pyfunction!(exit_span, module)?;
158158
exit_span_fn.setattr(
159159
"__module__",
160-
"monarch._src.actor._extension.hyperactor_extension.telemetry",
160+
"monarch._rust_bindings.hyperactor_extension.telemetry",
161161
)?;
162162
module.add_function(exit_span_fn)?;
163163

164164
let get_current_span_id_fn = wrap_pyfunction!(get_current_span_id, module)?;
165165
get_current_span_id_fn.setattr(
166166
"__module__",
167-
"monarch._src.actor._extension.hyperactor_extension.telemetry",
167+
"monarch._rust_bindings.hyperactor_extension.telemetry",
168168
)?;
169169
module.add_function(get_current_span_id_fn)?;
170170

171171
let use_real_clock_fn = wrap_pyfunction!(use_real_clock, module)?;
172172
use_real_clock_fn.setattr(
173173
"__module__",
174-
"monarch._src.actor._extension.hyperactor_extension.telemetry",
174+
"monarch._rust_bindings.hyperactor_extension.telemetry",
175175
)?;
176176
module.add_function(use_real_clock_fn)?;
177177

178178
let use_sim_clock_fn = wrap_pyfunction!(use_sim_clock, module)?;
179179
use_sim_clock_fn.setattr(
180180
"__module__",
181-
"monarch._src.actor._extension.hyperactor_extension.telemetry",
181+
"monarch._rust_bindings.hyperactor_extension.telemetry",
182182
)?;
183183
module.add_function(use_sim_clock_fn)?;
184184

monarch_extension/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ crate-type = ["cdylib"]
1616
[dependencies]
1717
anyhow = "1.0.98"
1818
async-trait = "0.1.86"
19+
bincode = "1.3.3"
1920
clap = { version = "4.5.38", features = ["derive", "env", "string", "unicode", "wrap_help"] }
2021
controller = { version = "0.0.0", path = "../controller", optional = true }
2122
hyperactor = { version = "0.0.0", path = "../hyperactor" }
23+
hyperactor_extension = { version = "0.0.0", path = "../hyperactor_extension" }
2224
hyperactor_mesh = { version = "0.0.0", path = "../hyperactor_mesh" }
2325
hyperactor_multiprocess = { version = "0.0.0", path = "../hyperactor_multiprocess" }
26+
libc = "0.2.139"
2427
monarch_hyperactor = { version = "0.0.0", path = "../monarch_hyperactor" }
2528
monarch_messages = { version = "0.0.0", path = "../monarch_messages", optional = true }
2629
monarch_simulator_lib = { version = "0.0.0", path = "../monarch_simulator", optional = true }
@@ -30,6 +33,7 @@ nccl-sys = { path = "../nccl-sys", optional = true }
3033
ndslice = { version = "0.0.0", path = "../ndslice" }
3134
pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods"] }
3235
pyo3-async-runtimes = { version = "0.24", features = ["attributes", "tokio-runtime"] }
36+
serde = { version = "1.0.185", features = ["derive", "rc"] }
3337
tokio = { version = "1.45.0", features = ["full", "test-util", "tracing"] }
3438
torch-sys = { version = "0.0.0", path = "../torch-sys", optional = true }
3539
torch-sys-cuda = { version = "0.0.0", path = "../torch-sys-cuda", optional = true }

actor_extension/src/blocking.rs renamed to monarch_extension/src/blocking.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ pub fn blocking_function() {
3131
/// Register Python bindings for the blocking module.
3232
pub fn register_python_bindings(module: &Bound<'_, PyModule>) -> PyResult<()> {
3333
let f = wrap_pyfunction!(blocking_function, module)?;
34-
f.setattr("__module__", "monarch._src.actor._extension.blocking")?;
34+
f.setattr(
35+
"__module__",
36+
"monarch._rust_bindings.monarch_extension.blocking",
37+
)?;
3538
module.add_function(f)?;
3639
Ok(())
3740
}

actor_extension/src/code_sync.rs renamed to monarch_extension/src/code_sync.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use serde::Serialize;
3131
#[pyclass(
3232
frozen,
3333
name = "WorkspaceLocation",
34-
module = "monarch._src.actor._extension.code_sync"
34+
module = "monarch._rust_bindings.monarch_extension.code_sync"
3535
)]
3636
#[derive(Clone, Debug, Serialize, Deserialize)]
3737
enum PyWorkspaceLocation {
@@ -75,7 +75,7 @@ impl PyWorkspaceLocation {
7575
#[pyclass(
7676
frozen,
7777
name = "RsyncMeshClient",
78-
module = "monarch._src.actor._extension.code_sync"
78+
module = "monarch._rust_bindings.monarch_extension.code_sync"
7979
)]
8080
pub struct RsyncMeshClient {
8181
actor_mesh: SharedCell<RootActorMesh<'static, rsync::RsyncActor>>,

monarch_extension/src/lib.rs

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#[cfg(feature = "tensor_engine")]
1212
mod client;
13+
pub mod code_sync;
1314
#[cfg(feature = "tensor_engine")]
1415
mod controller;
1516
#[cfg(feature = "tensor_engine")]
@@ -23,6 +24,8 @@ mod simulator_client;
2324
#[cfg(feature = "tensor_engine")]
2425
mod tensor_worker;
2526

27+
mod blocking;
28+
mod panic;
2629
use pyo3::prelude::*;
2730

2831
#[pyfunction]
@@ -61,6 +64,20 @@ fn get_or_add_new_module<'py>(
6164
#[pymodule]
6265
#[pyo3(name = "_rust_bindings")]
6366
pub fn mod_init(module: &Bound<'_, PyModule>) -> PyResult<()> {
67+
monarch_hyperactor::runtime::initialize(module.py())?;
68+
let runtime = monarch_hyperactor::runtime::get_tokio_runtime();
69+
::hyperactor::initialize(runtime.handle().clone());
70+
71+
monarch_hyperactor::shape::register_python_bindings(&get_or_add_new_module(
72+
module,
73+
"monarch_hyperactor.shape",
74+
)?)?;
75+
76+
monarch_hyperactor::selection::register_python_bindings(&get_or_add_new_module(
77+
module,
78+
"monarch_hyperactor.selection",
79+
)?)?;
80+
6481
#[cfg(feature = "tensor_engine")]
6582
{
6683
client::register_python_bindings(&get_or_add_new_module(
@@ -108,6 +125,69 @@ pub fn mod_init(module: &Bound<'_, PyModule>) -> PyResult<()> {
108125
module,
109126
"monarch_extension.simulation_tools",
110127
)?)?;
128+
monarch_hyperactor::bootstrap::register_python_bindings(&get_or_add_new_module(
129+
module,
130+
"monarch_hyperactor.bootstrap",
131+
)?)?;
132+
133+
monarch_hyperactor::proc::register_python_bindings(&get_or_add_new_module(
134+
module,
135+
"monarch_hyperactor.proc",
136+
)?)?;
137+
138+
monarch_hyperactor::actor::register_python_bindings(&get_or_add_new_module(
139+
module,
140+
"monarch_hyperactor.actor",
141+
)?)?;
142+
143+
monarch_hyperactor::mailbox::register_python_bindings(&get_or_add_new_module(
144+
module,
145+
"monarch_hyperactor.mailbox",
146+
)?)?;
147+
148+
monarch_hyperactor::alloc::register_python_bindings(&get_or_add_new_module(
149+
module,
150+
"monarch_hyperactor.alloc",
151+
)?)?;
152+
monarch_hyperactor::channel::register_python_bindings(&get_or_add_new_module(
153+
module,
154+
"monarch_hyperactor.channel",
155+
)?)?;
156+
monarch_hyperactor::actor_mesh::register_python_bindings(&get_or_add_new_module(
157+
module,
158+
"monarch_hyperactor.actor_mesh",
159+
)?)?;
160+
monarch_hyperactor::proc_mesh::register_python_bindings(&get_or_add_new_module(
161+
module,
162+
"monarch_hyperactor.proc_mesh",
163+
)?)?;
164+
165+
monarch_hyperactor::runtime::register_python_bindings(&get_or_add_new_module(
166+
module,
167+
"monarch_hyperactor.runtime",
168+
)?)?;
169+
hyperactor_extension::alloc::register_python_bindings(&get_or_add_new_module(
170+
module,
171+
"hyperactor_extension.alloc",
172+
)?)?;
173+
hyperactor_extension::telemetry::register_python_bindings(&get_or_add_new_module(
174+
module,
175+
"hyperactor_extension.telemetry",
176+
)?)?;
177+
code_sync::register_python_bindings(&get_or_add_new_module(
178+
module,
179+
"monarch_extension.code_sync",
180+
)?)?;
181+
182+
crate::panic::register_python_bindings(&get_or_add_new_module(
183+
module,
184+
"monarch_extension.panic",
185+
)?)?;
186+
187+
crate::blocking::register_python_bindings(&get_or_add_new_module(
188+
module,
189+
"monarch_extension.blocking",
190+
)?)?;
111191

112192
// Add feature detection function
113193
module.add_function(wrap_pyfunction!(has_tensor_engine, module)?)?;

0 commit comments

Comments
 (0)