diff --git a/crates/remote/src/grpc_remote_client.rs b/crates/remote/src/grpc_remote_client.rs index 0034003474f..bf241e5f678 100644 --- a/crates/remote/src/grpc_remote_client.rs +++ b/crates/remote/src/grpc_remote_client.rs @@ -22,12 +22,14 @@ use tonic::{ use tracing::{trace, warn}; fn map_transport_error(error: tonic::transport::Error) -> RemoteError { + dbg!(&error); RemoteError::GrpcConnectFailed { error: Box::new(error), } } fn map_status_error(error: tonic::Status) -> RemoteError { + dbg!(&error); RemoteError::GrpcCallFailed { error: Box::new(error), } diff --git a/crates/remote/src/remote_service.rs b/crates/remote/src/remote_service.rs index 4cc0b571755..e14faf4175f 100644 --- a/crates/remote/src/remote_service.rs +++ b/crates/remote/src/remote_service.rs @@ -83,6 +83,8 @@ impl RemoteService { let host = &self.config.host; let mut enabled = true; + dbg!(&self.capabilities); + if let Some(cap) = &self.capabilities.cache_capabilities { let sha256_fn = digest_function::Value::Sha256 as i32; @@ -362,6 +364,7 @@ async fn batch_upload_blobs( blobs = group.items.len(), size = group.size, max_size, + too_large = group.size > max_size, "Batching blobs upload (group {} of {})", group_index + 1, group_total @@ -426,6 +429,7 @@ async fn batch_download_blobs( blobs = group.items.len(), size = group.size, max_size, + too_large = group.size > max_size, "Batching blobs download (group {} of {})", group_index + 1, group_total @@ -484,7 +488,7 @@ fn partition_into_groups( // Try and find a partition that this item can go into for (index, group) in &groups { - if group.size + item_size < max_size { + if group.size + item_size <= max_size { index_to_use = *index; break; } @@ -495,12 +499,12 @@ fn partition_into_groups( index_to_use = groups.len() as i32; } - let entry = groups.entry(index_to_use).or_insert_with(|| Partition { + let group = groups.entry(index_to_use).or_insert_with(|| Partition { items: vec![], size: 0, }); - entry.size += item_size; - entry.items.push(item); + group.size += item_size; + group.items.push(item); } groups diff --git a/crates/task-runner/tests/task_runner_test.rs b/crates/task-runner/tests/task_runner_test.rs index 8291994dce4..45453ba0652 100644 --- a/crates/task-runner/tests/task_runner_test.rs +++ b/crates/task-runner/tests/task_runner_test.rs @@ -3,7 +3,6 @@ mod utils; use moon_action::ActionStatus; use moon_action_context::*; use moon_cache::CacheMode; -// use moon_remote::Digest; use moon_task::Target; use moon_task_runner::output_hydrater::HydrateFrom; use moon_task_runner::TaskRunner; @@ -11,13 +10,6 @@ use moon_time::now_millis; use std::env; use utils::*; -// fn stub_digest() -> Digest { -// Digest { -// hash: "hash123".into(), -// size_bytes: 0, -// } -// } - mod task_runner { use super::*; @@ -709,7 +701,6 @@ mod task_runner { fn setup_exec_state(runner: &mut TaskRunner) { runner.report_item.hash = Some("hash123".into()); - // runner.action_digest = stub_digest(); } #[tokio::test] @@ -1031,7 +1022,6 @@ mod task_runner { runner.cache.data.exit_code = 0; runner.cache.data.hash = "hash123".into(); - // runner.action_digest = stub_digest(); } #[tokio::test] @@ -1074,8 +1064,6 @@ mod task_runner { fn setup_local_state(container: &TaskRunnerContainer, _runner: &mut TaskRunner) { container.sandbox.enable_git(); container.pack_archive(); - - // runner.action_digest = stub_digest(); } #[tokio::test]