feat(bin, pipeline): report pipeline progress (#2932)

This commit is contained in:
Alexey Shekhirin
2023-06-01 02:17:33 +04:00
committed by GitHub
parent aea35263da
commit 9a0aeea543
3 changed files with 113 additions and 14 deletions

View File

@ -37,7 +37,7 @@ impl NodeState {
/// Processes an event emitted by the pipeline
fn handle_pipeline_event(&mut self, event: PipelineEvent) {
match event {
PipelineEvent::Running { stage_id, checkpoint } => {
PipelineEvent::Running { pipeline_position, pipeline_total, stage_id, checkpoint } => {
let notable = self.current_stage.is_none();
self.current_stage = Some(stage_id);
self.current_checkpoint = checkpoint.unwrap_or_default();
@ -45,6 +45,7 @@ impl NodeState {
if notable {
info!(
target: "reth::cli",
pipeline_stages = %format!("{pipeline_position}/{pipeline_total}"),
stage = %stage_id,
from = self.current_checkpoint.block_number,
checkpoint = %self.current_checkpoint,
@ -52,7 +53,12 @@ impl NodeState {
);
}
}
PipelineEvent::Ran { stage_id, result: ExecOutput { checkpoint, done } } => {
PipelineEvent::Ran {
pipeline_position,
pipeline_total,
stage_id,
result: ExecOutput { checkpoint, done },
} => {
self.current_checkpoint = checkpoint;
if done {
@ -61,6 +67,7 @@ impl NodeState {
info!(
target: "reth::cli",
pipeline_stages = %format!("{pipeline_position}/{pipeline_total}"),
stage = %stage_id,
progress = checkpoint.block_number,
%checkpoint,