diff --git a/hyperactor/src/channel.rs b/hyperactor/src/channel.rs index 65533713b..8eed8681a 100644 --- a/hyperactor/src/channel.rs +++ b/hyperactor/src/channel.rs @@ -906,7 +906,6 @@ mod tests { use super::*; use crate::clock::Clock; use crate::clock::RealClock; - use crate::config; #[test] fn test_channel_addr() { diff --git a/hyperactor/src/mailbox/undeliverable.rs b/hyperactor/src/mailbox/undeliverable.rs index 56a57cf98..441b90086 100644 --- a/hyperactor/src/mailbox/undeliverable.rs +++ b/hyperactor/src/mailbox/undeliverable.rs @@ -13,10 +13,8 @@ use serde::Serialize; use thiserror::Error; use crate as hyperactor; // for macros -use crate::ActorId; use crate::Message; use crate::Named; -use crate::PortId; use crate::actor::ActorStatus; use crate::id; use crate::mailbox::DeliveryError; diff --git a/hyperactor_macros/src/lib.rs b/hyperactor_macros/src/lib.rs index 20e41b214..df1797385 100644 --- a/hyperactor_macros/src/lib.rs +++ b/hyperactor_macros/src/lib.rs @@ -1636,10 +1636,7 @@ impl syn::parse::Parse for BehaviorInput { /// ``` #[proc_macro] pub fn behavior(input: TokenStream) -> TokenStream { - let BehaviorInput { - behavior: behavior, - handlers, - } = parse_macro_input!(input as BehaviorInput); + let BehaviorInput { behavior, handlers } = parse_macro_input!(input as BehaviorInput); let tys = HandlerSpec::add_indexed(handlers); let expanded = quote! { diff --git a/hyperactor_mesh/Cargo.toml b/hyperactor_mesh/Cargo.toml index 85f3afca9..ce287d016 100644 --- a/hyperactor_mesh/Cargo.toml +++ b/hyperactor_mesh/Cargo.toml @@ -65,7 +65,6 @@ libc = "0.2.139" mockall = "0.13.1" ndslice = { version = "0.0.0", path = "../ndslice" } nix = { version = "0.30.1", features = ["dir", "event", "hostname", "inotify", "ioctl", "mman", "mount", "net", "poll", "ptrace", "reboot", "resource", "sched", "signal", "term", "time", "user", "zerocopy"] } -notify = "5" opentelemetry = "0.29" pin-project = "1.1.10" preempt_rwlock = { version = "0.0.0", path = "../preempt_rwlock" } diff --git a/hyperactor_mesh/examples/dining_philosophers.rs b/hyperactor_mesh/examples/dining_philosophers.rs index 48f8a15c3..2106d6b68 100644 --- a/hyperactor_mesh/examples/dining_philosophers.rs +++ b/hyperactor_mesh/examples/dining_philosophers.rs @@ -23,7 +23,6 @@ use hyperactor::Named; use hyperactor::PortRef; use hyperactor::Unbind; use hyperactor::context; -use hyperactor_mesh::bootstrap::BootstrapCommand; use hyperactor_mesh::comm::multicast::CastInfo; use hyperactor_mesh::extent; use hyperactor_mesh::proc_mesh::global_root_client; diff --git a/hyperactor_mesh/examples/test_bench.rs b/hyperactor_mesh/examples/test_bench.rs index 71fdbe9c5..95dc66b5e 100644 --- a/hyperactor_mesh/examples/test_bench.rs +++ b/hyperactor_mesh/examples/test_bench.rs @@ -22,6 +22,8 @@ use hyperactor::Handler; use hyperactor::Named; use hyperactor::PortRef; use hyperactor::Unbind; +use hyperactor::clock::Clock; +use hyperactor::clock::RealClock; use hyperactor_mesh::bootstrap::BootstrapCommand; use hyperactor_mesh::comm::multicast::CastInfo; use hyperactor_mesh::proc_mesh::global_root_client; @@ -31,7 +33,6 @@ use ndslice::ViewExt; use ndslice::extent; use serde::Deserialize; use serde::Serialize; -use tokio::time::Instant; #[derive(Actor, Default, Debug)] #[hyperactor::export( @@ -84,7 +85,7 @@ async fn main() { loop { let mut received = HashSet::new(); let (port, mut rx) = instance.open_port(); - let begin = Instant::now(); + let begin = RealClock.now(); actor_mesh .cast(instance, TestMessage::Ping(port.bind())) .unwrap(); @@ -93,6 +94,6 @@ async fn main() { } eprintln!("ping {}ms", begin.elapsed().as_millis()); - tokio::time::sleep(Duration::from_secs(1)).await; + RealClock.sleep(Duration::from_secs(1)).await; } } diff --git a/hyperactor_mesh/src/actor_mesh.rs b/hyperactor_mesh/src/actor_mesh.rs index 66b13a336..c67068821 100644 --- a/hyperactor_mesh/src/actor_mesh.rs +++ b/hyperactor_mesh/src/actor_mesh.rs @@ -984,7 +984,7 @@ mod tests { .await .unwrap(); - let instance = crate::v1::testing::instance().await; + let instance = $crate::v1::testing::instance().await; let proc_mesh = ProcMesh::allocate(alloc).await.unwrap(); let (undeliverable_tx, _undeliverable_rx) = proc_mesh.client().open_port(); let params = PingPongActorParams::new(Some(undeliverable_tx.bind()), None); @@ -1030,7 +1030,7 @@ mod tests { .await .unwrap(); - let instance = crate::v1::testing::instance().await; + let instance = $crate::v1::testing::instance().await; let proc_mesh = ProcMesh::allocate(alloc).await.unwrap(); let actor_mesh: RootActorMesh = proc_mesh.spawn(&instance, "echo", &()).await.unwrap(); let dont_simulate_error = true; @@ -1074,7 +1074,7 @@ mod tests { .await .unwrap(); - let instance = crate::v1::testing::instance().await; + let instance = $crate::v1::testing::instance().await; let proc_mesh = ProcMesh::allocate(alloc).await.unwrap(); let actor_mesh: RootActorMesh = proc_mesh.spawn(&instance, "echo", &()).await.unwrap(); @@ -1096,7 +1096,7 @@ mod tests { #[tokio::test] async fn test_inter_proc_mesh_comms() { let mut meshes = Vec::new(); - let instance = crate::v1::testing::instance().await; + let instance = $crate::v1::testing::instance().await; for _ in 0..2 { let alloc = $allocator .allocate(AllocSpec { @@ -1157,7 +1157,7 @@ mod tests { .await .unwrap(); - let instance = crate::v1::testing::instance().await; + let instance = $crate::v1::testing::instance().await; let mut proc_mesh = ProcMesh::allocate(alloc).await.unwrap(); let (tx, mut rx) = hyperactor::mailbox::open_port(proc_mesh.client()); @@ -1220,7 +1220,7 @@ mod tests { .await .unwrap(); - let instance = crate::v1::testing::instance().await; + let instance = $crate::v1::testing::instance().await; let mesh = ProcMesh::allocate(alloc).await.unwrap(); let (reply_port_handle, mut reply_port_receiver) = mesh.client().open_port::(); let reply_port = reply_port_handle.bind(); diff --git a/hyperactor_mesh/src/bootstrap.rs b/hyperactor_mesh/src/bootstrap.rs index 20a62f031..a39c8f49e 100644 --- a/hyperactor_mesh/src/bootstrap.rs +++ b/hyperactor_mesh/src/bootstrap.rs @@ -257,11 +257,13 @@ pub enum Bootstrap { impl Bootstrap { /// Serialize the mode into a environment-variable-safe string by /// base64-encoding its JSON representation. + #[allow(clippy::result_large_err)] fn to_env_safe_string(&self) -> v1::Result { Ok(BASE64_STANDARD.encode(serde_json::to_string(&self)?)) } /// Deserialize the mode from the representation returned by [`to_env_safe_string`]. + #[allow(clippy::result_large_err)] fn from_env_safe_string(str: &str) -> v1::Result { let data = BASE64_STANDARD.decode(str)?; let data = std::str::from_utf8(&data)?; diff --git a/hyperactor_mesh/src/logging.rs b/hyperactor_mesh/src/logging.rs index 590b10811..0a69c0367 100644 --- a/hyperactor_mesh/src/logging.rs +++ b/hyperactor_mesh/src/logging.rs @@ -47,7 +47,6 @@ use hyperactor::data::Serialized; use hyperactor::declare_attrs; use hyperactor_telemetry::env; use hyperactor_telemetry::log_file_path; -use notify::Watcher; use serde::Deserialize; use serde::Serialize; use tokio::io; @@ -1657,12 +1656,14 @@ mod tests { "Expected deserialization to fail with invalid UTF-8 bytes" ); } + #[allow(dead_code)] struct MockLogSender { log_sender: mpsc::UnboundedSender<(OutputTarget, String)>, // (output_target, content) flush_called: Arc>, // Track if flush was called } impl MockLogSender { + #[allow(dead_code)] fn new(log_sender: mpsc::UnboundedSender<(OutputTarget, String)>) -> Self { Self { log_sender, diff --git a/hyperactor_mesh/src/logging/line_prefixing_writer.rs b/hyperactor_mesh/src/logging/line_prefixing_writer.rs index 25afc0bac..abd8efb2a 100644 --- a/hyperactor_mesh/src/logging/line_prefixing_writer.rs +++ b/hyperactor_mesh/src/logging/line_prefixing_writer.rs @@ -27,6 +27,7 @@ where W: io::AsyncWrite + Unpin, { /// Creates a new LinePrefixingWriter that will prefix each line with "[] ". + #[allow(dead_code)] pub fn new(local_rank: usize, inner: W) -> Self { let prefix = format!("[{}] ", local_rank).into_bytes(); Self { diff --git a/hyperactor_mesh/src/proc_mesh.rs b/hyperactor_mesh/src/proc_mesh.rs index 9c855316e..b960817d4 100644 --- a/hyperactor_mesh/src/proc_mesh.rs +++ b/hyperactor_mesh/src/proc_mesh.rs @@ -697,6 +697,7 @@ impl ProcMesh { .collect(), actor_event_router: actor_event_router.clone(), }), + #[allow(clippy::todo)] ProcMeshKind::V1(_proc_mesh) => todo!(), } } diff --git a/hyperactor_mesh/src/v1.rs b/hyperactor_mesh/src/v1.rs index d3f1e3525..f7eec84ed 100644 --- a/hyperactor_mesh/src/v1.rs +++ b/hyperactor_mesh/src/v1.rs @@ -124,13 +124,13 @@ pub enum Error { #[error( "error spawning proc mesh: statuses: {}", - RankedValues::invert(&*.statuses) + RankedValues::invert(statuses) )] ProcSpawnError { statuses: RankedValues }, #[error( "error spawning actor mesh: statuses: {}", - RankedValues::invert(&*.statuses) + RankedValues::invert(statuses) )] ActorSpawnError { statuses: RankedValues }, diff --git a/hyperactor_mesh/src/v1/actor_mesh.rs b/hyperactor_mesh/src/v1/actor_mesh.rs index fbdb56518..8b287fbf5 100644 --- a/hyperactor_mesh/src/v1/actor_mesh.rs +++ b/hyperactor_mesh/src/v1/actor_mesh.rs @@ -158,6 +158,7 @@ pub struct ActorMeshRef { impl ActorMeshRef { /// Cast a message to all the actors in this mesh + #[allow(clippy::result_large_err)] pub fn cast(&self, cx: &impl context::Actor, message: M) -> v1::Result<()> where A: RemoteHandles + RemoteHandles>, @@ -170,6 +171,7 @@ impl ActorMeshRef { /// This should *only* be used for temporary support for selections in the tensor /// engine. If you use this for anything else, you will be fired (you too, OSS /// contributor). + #[allow(clippy::result_large_err)] pub(crate) fn cast_for_tensor_engine_only_do_not_use( &self, cx: &impl context::Actor, @@ -183,6 +185,7 @@ impl ActorMeshRef { self.cast_with_selection(cx, sel, message) } + #[allow(clippy::result_large_err)] fn cast_with_selection( &self, cx: &impl context::Actor, @@ -226,6 +229,7 @@ impl ActorMeshRef { } } + #[allow(clippy::result_large_err)] fn cast_v0( &self, cx: &impl context::Actor, @@ -266,6 +270,7 @@ impl ActorMeshRef { } } + #[allow(clippy::result_large_err)] pub async fn actor_states( &self, cx: &impl context::Actor, diff --git a/hyperactor_mesh/src/v1/host_mesh.rs b/hyperactor_mesh/src/v1/host_mesh.rs index ab138807d..6e1be6176 100644 --- a/hyperactor_mesh/src/v1/host_mesh.rs +++ b/hyperactor_mesh/src/v1/host_mesh.rs @@ -606,6 +606,7 @@ pub struct HostMeshRef { impl HostMeshRef { /// Create a new (raw) HostMeshRef from the provided region and associated /// ranks, which must match in cardinality. + #[allow(clippy::result_large_err)] fn new(name: Name, region: Region, ranks: Vec) -> v1::Result { if region.num_ranks() != ranks.len() { return Err(v1::Error::InvalidRankCardinality { @@ -635,6 +636,7 @@ impl HostMeshRef { /// /// Currently, spawn issues direct calls to each host agent. This will be fixed by /// maintaining a comm actor on the host service procs themselves. + #[allow(clippy::result_large_err)] pub async fn spawn( &self, cx: &impl context::Actor, @@ -873,6 +875,7 @@ impl HostMeshRef { /// Get the state of all procs with Name in this host mesh. /// The procs iterator must be in rank order. + #[allow(clippy::result_large_err)] pub(crate) async fn proc_states( &self, cx: &impl context::Actor, diff --git a/hyperactor_mesh/src/v1/proc_mesh.rs b/hyperactor_mesh/src/v1/proc_mesh.rs index e2c2b8764..26352579d 100644 --- a/hyperactor_mesh/src/v1/proc_mesh.rs +++ b/hyperactor_mesh/src/v1/proc_mesh.rs @@ -187,8 +187,10 @@ impl ProcRef { /// A mesh of processes. #[derive(Debug)] pub struct ProcMesh { + #[allow(dead_code)] name: Name, allocation: ProcMeshAllocation, + #[allow(dead_code)] comm_actor_name: Option, current_ref: ProcMeshRef, } @@ -430,6 +432,7 @@ impl ProcMesh { } /// Detach the proc mesh from the lifetime of `self`, and return its reference. + #[allow(dead_code)] pub(crate) fn detach(self) -> ProcMeshRef { // This also keeps the ProcMeshAllocation::Allocated alloc task alive. self.current_ref @@ -495,7 +498,7 @@ enum ProcMeshAllocation { impl ProcMeshAllocation { fn extent(&self) -> &Extent { match self { - ProcMeshAllocation::Allocated { extent, .. } => &extent, + ProcMeshAllocation::Allocated { extent, .. } => extent, ProcMeshAllocation::Owned { extent, .. } => extent, } } @@ -562,6 +565,7 @@ pub struct ProcMeshRef { impl ProcMeshRef { /// Create a new ProcMeshRef from the given name, region, ranks, and so on. + #[allow(clippy::result_large_err)] fn new( name: Name, region: Region, diff --git a/hyperactor_mesh/src/v1/testactor.rs b/hyperactor_mesh/src/v1/testactor.rs index 94ce4a94a..df56443d4 100644 --- a/hyperactor_mesh/src/v1/testactor.rs +++ b/hyperactor_mesh/src/v1/testactor.rs @@ -29,7 +29,6 @@ use hyperactor::Named; use hyperactor::PortRef; use hyperactor::RefClient; use hyperactor::Unbind; -use hyperactor::attrs::Attrs; #[cfg(test)] use hyperactor::clock::Clock as _; #[cfg(test)] @@ -240,7 +239,7 @@ pub struct SetConfigAttrs(pub Vec); impl Handler for TestActor { async fn handle( &mut self, - cx: &Context, + _cx: &Context, SetConfigAttrs(attrs): SetConfigAttrs, ) -> Result<(), anyhow::Error> { let attrs = bincode::deserialize(&attrs)?; diff --git a/hyperactor_mesh/src/v1/value_mesh.rs b/hyperactor_mesh/src/v1/value_mesh.rs index fd20c3e11..285c5563f 100644 --- a/hyperactor_mesh/src/v1/value_mesh.rs +++ b/hyperactor_mesh/src/v1/value_mesh.rs @@ -10,7 +10,6 @@ use std::cmp::Ordering; use std::collections::HashMap; use std::collections::hash_map::Entry; use std::hash::Hash; -use std::hash::Hasher; use std::marker::PhantomData; use std::mem; use std::mem::MaybeUninit; @@ -111,6 +110,7 @@ impl TryFrom for (Range, u32) { /// exceeds the platform's addressable range. This ensures safe /// round-tripping between the serialized wire format and native /// representation. + #[allow(clippy::result_large_err)] fn try_from(r: Run) -> Result { let start = usize::try_from(r.start).map_err(|_| "run.start too large")?; let end = usize::try_from(r.end).map_err(|_| "run.end too large")?; @@ -203,6 +203,7 @@ impl ValueMesh { /// Returns [`Error::InvalidRankCardinality`] if `ranks.len() != /// region.num_ranks()`. /// ``` + #[allow(clippy::result_large_err)] pub(crate) fn new(region: Region, ranks: Vec) -> crate::v1::Result { let (actual, expected) = (ranks.len(), region.num_ranks()); if actual != expected { @@ -275,6 +276,7 @@ impl ValueMesh { /// - Unspecified ranks are filled with `default`. /// - Result is stored in RLE form; no dense `Vec` is /// materialized. + #[allow(clippy::result_large_err)] pub fn from_ranges_with_default( region: Region, default: T, @@ -410,6 +412,7 @@ impl ValueMesh { /// let mesh = ValueMesh::from_dense(region, vec![1, 1, 2, 2, 3]).unwrap(); /// // Internally compressed to three runs: [1, 1], [2, 2], [3] /// ``` + #[allow(clippy::result_large_err)] pub fn from_dense(region: Region, values: Vec) -> crate::v1::Result { let mut vm = Self::new(region, values)?; vm.compress_adjacent_in_place(); @@ -1280,6 +1283,7 @@ mod tests { } // Indexed collector naïve implementation (for reference). + #[allow(clippy::result_large_err)] fn build_value_mesh_indexed( region: Region, pairs: impl IntoIterator, diff --git a/monarch_extension/src/client.rs b/monarch_extension/src/client.rs index b1f92a01e..a743c2b96 100644 --- a/monarch_extension/src/client.rs +++ b/monarch_extension/src/client.rs @@ -578,7 +578,7 @@ impl ClientActor { } #[staticmethod] - fn new_with_parent(proc: &PyProc, parent: &PyActorId) -> PyResult { + fn new_with_parent(_proc: &PyProc, _parent: &PyActorId) -> PyResult { // XXX: unimplemented!("this is not a valid thing to do!"); // Ok(Self { diff --git a/monarch_extension/src/mesh_controller.rs b/monarch_extension/src/mesh_controller.rs index f47363821..ed28bd622 100644 --- a/monarch_extension/src/mesh_controller.rs +++ b/monarch_extension/src/mesh_controller.rs @@ -30,7 +30,6 @@ use hyperactor::Handler; use hyperactor::Instance; use hyperactor::PortRef; use hyperactor::ProcId; -use hyperactor::actor::ActorStatus; use hyperactor::context; use hyperactor::mailbox::MailboxSenderError; use hyperactor_mesh::Mesh; @@ -69,7 +68,6 @@ use monarch_tensor_worker::WorkerActor; use ndslice::Slice; use ndslice::ViewExt; use ndslice::selection::ReifySlice; -use pyo3::exceptions::PyRuntimeError; use pyo3::exceptions::PyValueError; use pyo3::prelude::*; use tokio::sync::Mutex; diff --git a/monarch_hyperactor/src/actor.rs b/monarch_hyperactor/src/actor.rs index 7a15350d1..e3c0832af 100644 --- a/monarch_hyperactor/src/actor.rs +++ b/monarch_hyperactor/src/actor.rs @@ -49,8 +49,6 @@ use serde::Serialize; use serde_bytes::ByteBuf; use serde_multipart::Part; use tokio::sync::Mutex; -use tokio::sync::mpsc::UnboundedReceiver; -use tokio::sync::mpsc::UnboundedSender; use tokio::sync::oneshot; use tracing::Instrument; diff --git a/monarch_hyperactor/src/bootstrap.rs b/monarch_hyperactor/src/bootstrap.rs index f10d3fe6d..0188d6b94 100644 --- a/monarch_hyperactor/src/bootstrap.rs +++ b/monarch_hyperactor/src/bootstrap.rs @@ -48,7 +48,7 @@ pub fn bootstrap_main(py: Python) -> PyResult> { } #[pyfunction] -pub fn run_worker_loop_forever(py: Python<'_>, address: &str) -> PyResult { +pub fn run_worker_loop_forever(_py: Python<'_>, address: &str) -> PyResult { let addr = ChannelAddr::from_zmq_url(address)?; // Check if we're running in a PAR/XAR build by looking for FB_XAR_INVOKED_NAME environment variable diff --git a/monarch_hyperactor/src/v1/actor_mesh.rs b/monarch_hyperactor/src/v1/actor_mesh.rs index 38abc5ade..d9d827803 100644 --- a/monarch_hyperactor/src/v1/actor_mesh.rs +++ b/monarch_hyperactor/src/v1/actor_mesh.rs @@ -45,7 +45,6 @@ use pyo3::exceptions::PyValueError; use pyo3::prelude::*; use pyo3::types::PyBytes; use tokio::sync::watch; -use tokio::task::JoinHandle; use tokio_util::sync::CancellationToken; use crate::actor::PythonActor; @@ -305,7 +304,7 @@ impl PythonActorMeshImpl { let (sender, receiver) = watch::channel(None); let cancel = CancellationToken::new(); let canceled = cancel.clone(); - let task = get_tokio_runtime().spawn(async move { + let _task = get_tokio_runtime().spawn(async move { // 3 seconds is chosen to not penalize short-lived successful calls, // while still able to catch issues before they look like a hang or timeout. let time_between_checks = tokio::time::Duration::from_secs(3); diff --git a/monarch_types/src/lib.rs b/monarch_types/src/lib.rs index 08b827d0d..0a676109b 100644 --- a/monarch_types/src/lib.rs +++ b/monarch_types/src/lib.rs @@ -12,8 +12,6 @@ mod pyobject; mod python; mod pytree; -use std::error::Error; - use pyo3::PyErr; use pyo3::exceptions::PyValueError; pub use pyobject::PickledPyObject;