Skip to content

Commit ef1e28b

Browse files
diliopfacebook-github-bot
authored andcommitted
upgrade to 0.24.2
Summary: Upgrade `pyo3` from `0.22.6` to [`0.24.2`](https://github.com/PyO3/pyo3/releases/tag/v0.24.2) Reviewed By: dtolnay Differential Revision: D76439927 fbshipit-source-id: 6c8d692ea895ac5a4a2d047045bf81208e75986f
1 parent a2d4277 commit ef1e28b

File tree

12 files changed

+31
-22
lines changed

12 files changed

+31
-22
lines changed

controller/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ hyperactor_multiprocess = { version = "0.0.0", path = "../hyperactor_multiproces
2323
monarch_messages = { version = "0.0.0", path = "../monarch_messages" }
2424
nccl-sys = { path = "../nccl-sys" }
2525
ndslice = { version = "0.0.0", path = "../ndslice" }
26-
pyo3 = { version = "0.22.6", features = ["anyhow"] }
26+
pyo3 = { version = "0.24", features = ["anyhow"] }
2727
serde = { version = "1.0.185", features = ["derive", "rc"] }
2828
serde_json = { version = "1.0.140", features = ["float_roundtrip", "unbounded_depth"] }
2929
tokio = { version = "1.45.0", features = ["full", "test-util", "tracing"] }

hyperactor_extension/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ async-trait = "0.1.86"
1212
hyperactor = { version = "0.0.0", path = "../hyperactor" }
1313
hyperactor_mesh = { version = "0.0.0", path = "../hyperactor_mesh" }
1414
ndslice = { version = "0.0.0", path = "../ndslice" }
15-
pyo3 = { version = "0.22.6", features = ["anyhow"] }
15+
pyo3 = { version = "0.24", features = ["anyhow"] }
1616
tracing = { version = "0.1.41", features = ["attributes", "valuable"] }

monarch_extension/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ monarch_tensor_worker = { version = "0.0.0", path = "../monarch_tensor_worker",
2828
monarch_types = { version = "0.0.0", path = "../monarch_types" }
2929
nccl-sys = { path = "../nccl-sys", optional = true }
3030
ndslice = { version = "0.0.0", path = "../ndslice" }
31-
pyo3 = { version = "0.22.6", features = ["anyhow"] }
31+
pyo3 = { version = "0.24", features = ["anyhow"] }
3232
tokio = { version = "1.45.0", features = ["full", "test-util", "tracing"] }
3333
torch-sys = { version = "0.0.0", path = "../torch-sys", optional = true }
3434
torch-sys-cuda = { version = "0.0.0", path = "../torch-sys-cuda", optional = true }

monarch_hyperactor/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ hyperactor_multiprocess = { version = "0.0.0", path = "../hyperactor_multiproces
1919
hyperactor_telemetry = { version = "0.0.0", path = "../hyperactor_telemetry" }
2020
monarch_types = { version = "0.0.0", path = "../monarch_types" }
2121
ndslice = { version = "0.0.0", path = "../ndslice" }
22-
pyo3 = { version = "0.22.6", features = ["anyhow"] }
23-
pyo3-async-runtimes = { git = "https://github.com/PyO3/pyo3-async-runtimes", rev = "f6bb9b471a5b7765dd770af36e83f26802459621", features = ["attributes", "tokio-runtime"] }
22+
pyo3 = { version = "0.24", features = ["anyhow"] }
23+
pyo3-async-runtimes = { git = "https://github.com/PyO3/pyo3-async-runtimes", rev = "c5a3746f110b4d246556b0f6c29f5f555919eee3", features = ["attributes", "tokio-runtime"] }
2424
serde = { version = "1.0.185", features = ["derive", "rc"] }
2525
serde_bytes = "0.11"
2626
thiserror = "2.0.12"

monarch_messages/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ enum-as-inner = "0.6.0"
1414
hyperactor = { version = "0.0.0", path = "../hyperactor" }
1515
monarch_types = { version = "0.0.0", path = "../monarch_types" }
1616
ndslice = { version = "0.0.0", path = "../ndslice" }
17-
pyo3 = { version = "0.22.6", features = ["anyhow"] }
17+
pyo3 = { version = "0.24", features = ["anyhow"] }
1818
serde = { version = "1.0.185", features = ["derive", "rc"] }
1919
serde_bytes = "0.11"
2020
thiserror = "2.0.12"

monarch_messages/src/worker.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,16 @@ pub enum ResolvableFunction {
307307
FunctionPath(FunctionPath),
308308
}
309309

310-
impl IntoPy<PyObject> for ResolvableFunction {
311-
fn into_py(self, py: Python<'_>) -> PyObject {
312-
match self {
313-
Self::Cloudpickle(func) => func.into_py(py),
314-
Self::FunctionPath(func) => func.into_py(py),
315-
}
310+
impl<'py> IntoPyObject<'py> for ResolvableFunction {
311+
type Target = PyAny;
312+
type Output = Bound<'py, Self::Target>;
313+
type Error = PyErr;
314+
315+
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
316+
Ok(match self {
317+
Self::Cloudpickle(func) => func.into_pyobject(py)?.into_any(),
318+
Self::FunctionPath(func) => func.into_pyobject(py)?.into_any(),
319+
})
316320
}
317321
}
318322

monarch_meta_extension/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ fbinit = { version = "0.2.0", git = "https://github.com/facebookexperimental/rus
1919
hyperactor = { version = "0.0.0", path = "../hyperactor" }
2020
hyperactor_extension = { version = "0.0.0", path = "../hyperactor_extension" }
2121
hyperactor_mesh = { version = "0.0.0", path = "../hyperactor_mesh" }
22-
pyo3 = { version = "0.22.6", features = ["anyhow"] }
23-
pyo3-async-runtimes = { git = "https://github.com/PyO3/pyo3-async-runtimes", rev = "f6bb9b471a5b7765dd770af36e83f26802459621", features = ["attributes", "tokio-runtime"] }
22+
pyo3 = { version = "0.24", features = ["anyhow"] }
23+
pyo3-async-runtimes = { git = "https://github.com/PyO3/pyo3-async-runtimes", rev = "c5a3746f110b4d246556b0f6c29f5f555919eee3", features = ["attributes", "tokio-runtime"] }
2424
tokio = { version = "1.45.0", features = ["full", "test-util", "tracing"] }

monarch_tensor_worker/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ monarch_types = { version = "0.0.0", path = "../monarch_types" }
2525
ndslice = { version = "0.0.0", path = "../ndslice" }
2626
nix = { version = "0.29.0", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "signal", "term", "time", "user", "zerocopy"] }
2727
parking_lot = { version = "0.12.1", features = ["send_guard"] }
28-
pyo3 = { version = "0.22.6", features = ["anyhow"] }
28+
pyo3 = { version = "0.24", features = ["anyhow"] }
2929
serde = { version = "1.0.185", features = ["derive", "rc"] }
3030
serde_json = { version = "1.0.140", features = ["float_roundtrip", "unbounded_depth"] }
3131
sorted-vec = "0.8.3"

monarch_tensor_worker/src/pipe.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl<T: std::fmt::Debug + Write + Sync + Send> WriteDebug for T {}
181181

182182
pub struct StreamPipe {
183183
writer: Box<dyn WriteDebug>,
184-
channel_reader: ::std::sync::mpsc::Receiver<Vec<u8>>,
184+
channel_reader: std::sync::Arc<std::sync::Mutex<::std::sync::mpsc::Receiver<Vec<u8>>>>,
185185
}
186186

187187
impl StreamPipe {
@@ -224,7 +224,7 @@ impl StreamPipe {
224224

225225
StreamPipe {
226226
writer: Box::new(writer),
227-
channel_reader,
227+
channel_reader: std::sync::Arc::new(std::sync::Mutex::new(channel_reader)),
228228
}
229229
}
230230
}
@@ -240,7 +240,12 @@ impl<T: Serialize + DeserializeOwned> Pipe<T> for StreamPipe {
240240
}
241241

242242
fn recv(&mut self) -> Result<T> {
243-
let buf = self.channel_reader.recv().expect("recv failed");
243+
let buf = self
244+
.channel_reader
245+
.lock()
246+
.unwrap()
247+
.recv()
248+
.expect("recv failed");
244249
Ok(bincode::deserialize(&buf)?)
245250
}
246251
}

monarch_tensor_worker/src/py_pipe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::pipe::Pipe;
2121
/// Wrapper around `Pipe` to make it usable in Python.
2222
#[pyclass]
2323
pub struct PyPipe {
24-
pipe: Box<dyn Pipe<PyTree<RValue>> + Send>,
24+
pipe: Box<dyn Pipe<PyTree<RValue>> + Send + Sync>,
2525
#[pyo3(get)]
2626
ranks: HashMap<String, usize>,
2727
#[pyo3(get)]
@@ -31,7 +31,7 @@ pub struct PyPipe {
3131

3232
impl PyPipe {
3333
pub fn new(
34-
pipe: Box<dyn Pipe<PyTree<RValue>> + Send>,
34+
pipe: Box<dyn Pipe<PyTree<RValue>> + Send + Sync>,
3535
ranks: HashMap<String, usize>,
3636
sizes: HashMap<String, usize>,
3737
allow_unsafe_obj_conversion: bool,

monarch_types/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ license = "BSD-3-Clause"
1010
[dependencies]
1111
derive_more = { version = "1.0.0", features = ["full"] }
1212
hyperactor = { version = "0.0.0", path = "../hyperactor" }
13-
pyo3 = { version = "0.22.6", features = ["anyhow"] }
13+
pyo3 = { version = "0.24", features = ["anyhow"] }
1414
serde = { version = "1.0.185", features = ["derive", "rc"] }
1515
serde_bytes = "0.11"
1616

torch-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ derive_more = { version = "1.0.0", features = ["full"] }
1717
monarch_types = { version = "0.0.0", path = "../monarch_types" }
1818
nccl-sys = { path = "../nccl-sys", optional = true }
1919
paste = "1.0.14"
20-
pyo3 = { version = "0.22.6", features = ["anyhow"] }
20+
pyo3 = { version = "0.24", features = ["anyhow"] }
2121
regex = "1.11.1"
2222
serde = { version = "1.0.185", features = ["derive", "rc"] }
2323
thiserror = "2.0.12"

0 commit comments

Comments
 (0)