Fix perf stats filename for relative path clusters

Summary:
The computation of the perf stats file did not work in case -cluster was
passed a (relative) path.

Also, do not fail if the perf stats file cannot be opened/written, just
log a warning to stdout.

Reviewed By: jvillard

Differential Revision: D3269727

fb-gh-sync-id: c141ffa
fbshipit-source-id: c141ffa
master
Josh Berdine 9 years ago committed by Facebook Github Bot 3
parent b20ef20644
commit 12e42fefd9

@ -13,6 +13,7 @@ open! Utils
let register_report_at_exit file = let register_report_at_exit file =
Pervasives.at_exit (fun () -> Pervasives.at_exit (fun () ->
try
let gc_stats = Gc.quick_stat () in let gc_stats = Gc.quick_stat () in
let exit_timeofday = Unix.gettimeofday () in let exit_timeofday = Unix.gettimeofday () in
let exit_times = Unix.times () in let exit_times = Unix.times () in
@ -34,4 +35,6 @@ let register_report_at_exit file =
let stats_oc = open_out file in let stats_oc = open_out file in
Yojson.Basic.pretty_to_channel stats_oc stats ; Yojson.Basic.pretty_to_channel stats_oc stats ;
close_out stats_oc close_out stats_oc
with _ ->
Format.fprintf Format.std_formatter "Info: failed to write stats to %s@." file
) )

@ -355,7 +355,7 @@ let process_cluster_cmdline fname =
let register_perf_stats_report () = let register_perf_stats_report () =
let stats_dir = Filename.concat !Config.results_dir Config.backend_stats_dir_name in let stats_dir = Filename.concat !Config.results_dir Config.backend_stats_dir_name in
let cluster = match !cluster_cmdline with Some cl -> "_" ^ cl | None -> "" in let cluster = match !cluster_cmdline with Some cl -> "_" ^ (Filename.basename cl) | None -> "" in
let stats_file = Filename.concat stats_dir (Config.perf_stats_prefix ^ cluster ^ ".json") in let stats_file = Filename.concat stats_dir (Config.perf_stats_prefix ^ cluster ^ ".json") in
DB.create_dir !Config.results_dir ; DB.create_dir !Config.results_dir ;
DB.create_dir stats_dir ; DB.create_dir stats_dir ;

Loading…
Cancel
Save