[taskbar] leave progress bar displayed at the end of the analysis

Summary:
The code was already trying to do that but failing. Now it works.

This revealed a slight bug where the progress bar would always stop at
N-1/N 99% jobs. Fixed by moving the progress bar updates *after* the
operation that might decrease the number of jobs left.

Reviewed By: mityal

Differential Revision: D17423978

fbshipit-source-id: fc32db5f3
master
Jules Villard 5 years ago committed by Facebook Github Bot
parent 85977bf327
commit a01639e098

@ -189,7 +189,7 @@ let main ~changed_files =
(* empty all caches to minimize the process heap to have less work to do when forking *)
clear_caches () ;
let stats = analyze source_files in
L.progress "@\nAnalysis phase finished in %a@." Mtime.Span.pp (Mtime_clock.count time0) ;
L.debug Analysis Quiet "collected stats:@\n%a@." BackendStats.pp stats ;
L.debug Analysis Quiet "Analysis phase finished in %a@\n" Mtime.Span.pp (Mtime_clock.count time0) ;
L.debug Analysis Quiet "Collected stats:@\n%a@." BackendStats.pp stats ;
BackendStats.log_to_scuba stats ;
output_json_makefile_stats source_files

@ -221,8 +221,6 @@ let process_updates pool buffer =
Unix.wait (`Pid pid) |> ignore ;
killall pool ~slot "see backtrace above"
| Ready slot ->
TaskBar.set_remaining_tasks pool.task_bar (pool.tasks.remaining_tasks ()) ;
TaskBar.update_status pool.task_bar ~slot (Mtime_clock.now ()) "idle" ;
( match pool.children_states.(slot) with
| Processing work ->
pool.tasks.finished work
@ -230,6 +228,8 @@ let process_updates pool buffer =
()
| Idle ->
L.die InternalError "Received a Ready message from an idle worker@." ) ;
TaskBar.set_remaining_tasks pool.task_bar (pool.tasks.remaining_tasks ()) ;
TaskBar.update_status pool.task_bar ~slot (Mtime_clock.now ()) "idle" ;
pool.children_states.(slot) <- Idle ) ;
(* try to schedule more work if there are idle workers *)
if not (pool.tasks.is_empty ()) then

@ -45,6 +45,8 @@ let rec pp_n c fmt n =
let move_bol = "\r"
let move_cursor_down n = Printf.sprintf "\027[%iB" n
let move_cursor_up n = Printf.sprintf "\027[%iA" n
let erase_eol = "\027[0K"
@ -185,9 +187,10 @@ let tasks_done_reset task_bar =
let finish = function
| MultiLine _ ->
| MultiLine _ as task_bar ->
refresh task_bar ;
(* leave the progress bar displayed *)
Out_channel.output_string stderr "\n" ;
F.eprintf "%s%!" (move_cursor_down 1) ;
ANSITerminal.erase Below ;
Out_channel.flush stderr
| NonInteractive | Quiet ->

Loading…
Cancel
Save