Skip to content

Commit 426225e

Browse files
zdevitometa-codesync[bot]
authored andcommitted
Delete old tensor worker bootstrap (#1965)
Summary: Pull Request resolved: #1965 This is only used in the old workers. Trimming down tensor_engine_worker so we can remove torch dependencies more easily. ghstack-source-id: 324851498 exported-using-ghexport Reviewed By: mariusae Differential Revision: D87574093 fbshipit-source-id: 86893f9479ba4f06b56c6c46c49ad600d449e482
1 parent ee83c9d commit 426225e

File tree

8 files changed

+115
-728
lines changed

8 files changed

+115
-728
lines changed

monarch_extension/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,6 @@ pub fn mod_init(module: &Bound<'_, PyModule>) -> PyResult<()> {
120120
module,
121121
"monarch_messages.debugger",
122122
)?)?;
123-
::monarch_tensor_worker::bootstrap::register_python_bindings(&get_or_add_new_module(
124-
module,
125-
"monarch_tensor_worker.bootstrap",
126-
)?)?;
127123
crate::convert::register_python_bindings(&get_or_add_new_module(
128124
module,
129125
"monarch_extension.convert",

monarch_extension/src/tensor_worker.rs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,9 @@
1414
/// + support for constructor specialization will help avoid duplication here.
1515
/// TODO: Potentially too many clones of slice objects, might need to refactor to avoid that.
1616
use std::collections::HashMap;
17-
use std::fs::File;
18-
use std::io::BufReader;
1917
use std::ops::DerefMut;
20-
use std::os::fd::FromRawFd;
21-
use std::os::fd::OwnedFd;
2218

2319
use anyhow::Result;
24-
use clap::Parser;
2520
use hyperactor::data::Serialized;
2621
use hyperactor::reference::ActorId;
2722
use monarch_hyperactor::ndslice::PySlice;
@@ -30,10 +25,6 @@ use monarch_hyperactor::runtime::get_tokio_runtime;
3025
use monarch_messages::wire_value::WireValue;
3126
use monarch_messages::wire_value::func_call_args_to_wire_values;
3227
use monarch_messages::worker::*;
33-
use monarch_tensor_worker::bootstrap::BinaryArgs;
34-
use monarch_tensor_worker::bootstrap::bootstrap_pipe;
35-
use monarch_tensor_worker::bootstrap::bootstrap_worker_proc;
36-
use monarch_tensor_worker::bootstrap::worker_server;
3728
use monarch_types::TryIntoPyObjectUnsafe;
3829
use pyo3::IntoPyObjectExt;
3930
use pyo3::exceptions::PyRuntimeError;
@@ -1377,33 +1368,6 @@ pub(crate) fn worker_message_to_py(py: Python<'_>, message: &WorkerMessage) -> P
13771368
}
13781369
}
13791370

1380-
/// The Python main entry point of the monarch worker from Python. It allows to bundle Python dependencies
1381-
/// during packaging.
1382-
#[pyfunction]
1383-
fn worker_main(py: Python<'_>) -> PyResult<()> {
1384-
let argv: Vec<String> = py.import("sys")?.getattr("argv")?.extract()?;
1385-
Python::allow_threads(py, move || {
1386-
let args = BinaryArgs::parse_from(argv);
1387-
1388-
match args {
1389-
BinaryArgs::Pipe => bootstrap_pipe(),
1390-
BinaryArgs::WorkerServer { rd, wr } => {
1391-
worker_server(
1392-
// SAFETY: Raw FD passed in from parent.
1393-
BufReader::new(File::from(unsafe { OwnedFd::from_raw_fd(rd) })),
1394-
// SAFETY: Raw FD passed in from parent.
1395-
File::from(unsafe { OwnedFd::from_raw_fd(wr) }),
1396-
)
1397-
}
1398-
BinaryArgs::Worker(args) => get_tokio_runtime().block_on(async move {
1399-
let _ = bootstrap_worker_proc(args).await?.await;
1400-
Ok(())
1401-
}),
1402-
}
1403-
.map_err(|err: anyhow::Error| PyRuntimeError::new_err(err.to_string()))
1404-
})
1405-
}
1406-
14071371
pub(crate) fn register_python_bindings(worker_mod: &Bound<'_, PyModule>) -> PyResult<()> {
14081372
worker_mod.add_class::<PyWorkerMessage>()?;
14091373
worker_mod.add_class::<BackendNetworkInit>()?;
@@ -1438,12 +1402,6 @@ pub(crate) fn register_python_bindings(worker_mod: &Bound<'_, PyModule>) -> PyRe
14381402
worker_mod.add_class::<RecordingFormal>()?;
14391403
worker_mod.add_class::<RecordingResult>()?;
14401404
worker_mod.add_class::<CallRecording>()?;
1441-
let f = wrap_pyfunction!(worker_main, worker_mod)?;
1442-
f.setattr(
1443-
"__module__",
1444-
"monarch._rust_bindings.monarch_extension.tensor_worker",
1445-
)?;
1446-
worker_mod.add_function(f)?;
14471405

14481406
Ok(())
14491407
}

monarch_tensor_worker/src/bootstrap.rs

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

monarch_tensor_worker/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
//! - debugger support
2828
//! - general drift in exisitng messages
2929
30-
pub mod bootstrap;
3130
mod borrow;
3231
mod comm;
3332
pub mod device_mesh;

0 commit comments

Comments
 (0)