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
This commit is contained in:
Stanislau Hlebik 2020-04-09 23:38:56 -07:00 committed by Facebook GitHub Bot
parent 1949f4e528
commit 8ffb6af331

View File

@ -423,27 +423,28 @@ async fn subcommand_backfill<P: AsRef<Path>>(
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<P: AsRef<Path>>(
);
}
out
Ok(())
}
})
.await