From b12ac1be7997f4ce2f43d5978c3284ef19002025 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 15 Apr 2020 19:25:43 +0200 Subject: [PATCH] Read all EZFIO in memory before run starts --- ocaml/Qmcchem_dataserver.ml | 7 ++++++- ocaml/Qmcchem_forwarder.ml | 1 - ocaml/qptypes_generator.ml | 9 ++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ocaml/Qmcchem_dataserver.ml b/ocaml/Qmcchem_dataserver.ml index 0b3fe53..108d606 100644 --- a/ocaml/Qmcchem_dataserver.ml +++ b/ocaml/Qmcchem_dataserver.ml @@ -587,12 +587,17 @@ let run ?(daemon=true) ezfio_filename = | None -> begin let result = - decode_ezfio_message msg + Qptypes.decode_ezfio_message msg in Hashtbl.add ezfio_cache msg result; result end in + List.iter (fun x -> + if handle_ezfio ("has_"^x) = "T" then + try ignore @@ handle_ezfio ("get_"^x) + with Failure _ -> ()) + Qptypes.all_ezfio_messages; (** Pull socket for computed data *) let pull_socket = diff --git a/ocaml/Qmcchem_forwarder.ml b/ocaml/Qmcchem_forwarder.ml index acca486..33e84a9 100644 --- a/ocaml/Qmcchem_forwarder.ml +++ b/ocaml/Qmcchem_forwarder.ml @@ -54,7 +54,6 @@ let run ezfio_filename dataserver = | Unix.Unix_error _ -> begin Unix.chdir tmpdir; - Unix.sleepf 0.1 ; if Sys.file_exists "PID" then begin let pid = diff --git a/ocaml/qptypes_generator.ml b/ocaml/qptypes_generator.ml index 387266c..981686e 100644 --- a/ocaml/qptypes_generator.ml +++ b/ocaml/qptypes_generator.ml @@ -341,7 +341,14 @@ match msg with " ] @ List.map (fun (x,_,_,_) -> Printf.sprintf " | \"%s\" -> if (Ezfio.%s ()) then \"T\" else \"F\"" x x ) has_functions - ) @ [" | x -> failwith (x^\" : Unknown EZFIO function\")\n;;"] + ) + @ [" | x -> failwith (x^\" : Unknown EZFIO function\")\n;;" ; + "" ; "let all_ezfio_messages = [ " ] @ + ( + List.rev_map (fun (x,_,_,_) -> + Printf.sprintf " \"%s\" ; " (String.sub x 4 ((String.length x)-4)) + ) has_functions + ) @ ["]"] in String.concat "\n" result |> print_endline