From 8ffb6af331abc4827db4a7348e01483b33bb2d1d Mon Sep 17 00:00:00 2001 From: Stanislau Hlebik Date: Thu, 9 Apr 2020 23:38:56 -0700 Subject: [PATCH] mononoke: measure the whole duration of deriving chunks Summary: We were exluding warmup, which might take a noticeable amount of time. Let's measure everything Reviewed By: krallin Differential Revision: D20920211 fbshipit-source-id: f48b0c2425eb2bae2991fa537dde1bc61b5e44ac --- eden/mononoke/cmds/backfill_derived_data.rs | 41 +++++++++++---------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/eden/mononoke/cmds/backfill_derived_data.rs b/eden/mononoke/cmds/backfill_derived_data.rs index ca23b23c06..3fa192c256 100644 --- a/eden/mononoke/cmds/backfill_derived_data.rs +++ b/eden/mononoke/cmds/backfill_derived_data.rs @@ -423,27 +423,28 @@ async fn subcommand_backfill>( stream::iter(changesets) .chunks(CHUNK_SIZE) - .then({ - move |chunk| { - derived_utils - .pending(ctx.clone(), repo.clone(), chunk.clone()) - .compat() - } - }) - .and_then({ - move |chunk| async move { - warmup(ctx, repo, derived_data_type, &chunk).await?; - Ok(chunk) - } - }) + .map(Ok) .try_for_each({ move |chunk| async move { - let chunk_size = chunk.len(); - let (stats, out) = derived_utils - .derive_batch(ctx.clone(), repo.clone(), chunk) - .compat() - .timed() - .await; + let (stats, chunk_size) = async { + let chunk = derived_utils + .pending(ctx.clone(), repo.clone(), chunk) + .compat() + .await?; + let chunk_size = chunk.len(); + + warmup(ctx, repo, derived_data_type, &chunk).await?; + + derived_utils + .derive_batch(ctx.clone(), repo.clone(), chunk) + .compat() + .await?; + Result::<_, Error>::Ok(chunk_size) + } + .timed() + .await; + + let chunk_size = chunk_size?; generated_count.fetch_add(chunk_size, Ordering::SeqCst); let elapsed = total_duration.with(|total_duration| { *total_duration += stats.completion_time; @@ -465,7 +466,7 @@ async fn subcommand_backfill>( ); } - out + Ok(()) } }) .await