Skip to content

Commit

Permalink
Update time summary calculation for tasks #446
Browse files Browse the repository at this point in the history
  • Loading branch information
sagiegurari committed Aug 19, 2020
1 parent 3d82de2 commit e4635d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/lib/runner.rs
Expand Up @@ -318,7 +318,11 @@ pub(crate) fn run_task(flow_info: &FlowInfo, flow_state: &mut FlowState, step: &
});

match step.config.run_task {
Some(ref sub_task) => run_sub_task(&flow_info, flow_state, sub_task),
Some(ref sub_task) => {
time_summary::add(&mut flow_state.time_summary, &step.name, start_time);

run_sub_task(&flow_info, flow_state, sub_task);
}
None => {
do_in_task_working_directory(&step, || {
// run script
Expand All @@ -330,11 +334,11 @@ pub(crate) fn run_task(flow_info: &FlowInfo, flow_state: &mut FlowState, step: &
command::run(&updated_step);
};
});

time_summary::add(&mut flow_state.time_summary, &step.name, start_time);
}
};
}

time_summary::add(&mut flow_state.time_summary, &step.name, start_time);
} else {
let fail_message = match step.config.condition {
Some(ref condition) => match condition.fail_message {
Expand Down
3 changes: 2 additions & 1 deletion src/lib/time_summary.rs
Expand Up @@ -26,7 +26,7 @@ pub(crate) fn print(time_summary: &Vec<(String, u128)>) {
}
}

info!("=====Time Summary=====");
info!("================Time Summary================");
for entry in time_summary {
let percentage = (entry.1 as f64 / total_time as f64) * 100.0;
let seconds = entry.1 as f64 / 1000.0;
Expand All @@ -38,6 +38,7 @@ pub(crate) fn print(time_summary: &Vec<(String, u128)>) {
entry.0, gap, percentage, seconds
);
}
info!("============================================");
}
}

Expand Down

0 comments on commit e4635d1

Please sign in to comment.