let get_log_of_monitored_script ~host ~script =
let log_file = Ketrew_monitored_script.log_file script in
begin Ketrew_host_io.get_file host ~path:log_file
>>< function
| `Ok c -> return (Some c)
| `Error (`Cannot_read_file _) -> return None
| `Error (`Timeout _ as e) -> fail e
end
>>= fun log_content ->
let log = Option.map ~f:Ketrew_monitored_script.parse_log log_content in
return log