Skip to content

Commit

Permalink
More debugging.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Jan 24, 2025
1 parent 9ead1e0 commit ca1833a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
2 changes: 2 additions & 0 deletions crates/remote/src/grpc_remote_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
12 changes: 8 additions & 4 deletions crates/remote/src/remote_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -484,7 +488,7 @@ fn partition_into_groups<T>(

// 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;
}
Expand All @@ -495,12 +499,12 @@ fn partition_into_groups<T>(
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
Expand Down
12 changes: 0 additions & 12 deletions crates/task-runner/tests/task_runner_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,13 @@ 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;
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::*;

Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit ca1833a

Please sign in to comment.