remarks from running

This commit is contained in:
Hannes Mehnert 2020-12-01 11:12:25 +01:00
parent fc4afd870f
commit 8a342e4ddb

View file

@ -185,6 +185,7 @@ let job_finished state uuid res data =
ignore (Bos.OS.File.write p value)) ignore (Bos.OS.File.write p value))
data; data;
let in_dir = Fpath.(out_dir / "input") in let in_dir = Fpath.(out_dir / "input") in
ignore (Bos.OS.Dir.create in_dir);
List.iter (fun (path, value) -> List.iter (fun (path, value) ->
let p = Fpath.append in_dir path in let p = Fpath.append in_dir path in
ignore (Bos.OS.Dir.create (Fpath.parent p)); ignore (Bos.OS.Dir.create (Fpath.parent p));
@ -228,8 +229,10 @@ let handle t fd addr =
| Some job -> Lwt.return job | Some job -> Lwt.return job
in in
Lwt.bind (find_job ()) (fun job -> Lwt.bind (find_job ()) (fun job ->
(* TODO set a timer / timeout and re-queue the same job if timeout expired *)
ignore (dump t); ignore (dump t);
let uuid = uuid_gen () in let uuid = uuid_gen () in
(* TODO if this write fails, put job back into queue! *)
write_cmd fd (Builder.Job_schedule (uuid, job)) >>= fun () -> write_cmd fd (Builder.Job_schedule (uuid, job)) >>= fun () ->
Logs.app (fun m -> m "job %a scheduled %a" Logs.app (fun m -> m "job %a scheduled %a"
Uuidm.pp uuid Builder.pp_job job); Uuidm.pp uuid Builder.pp_job job);