Commit 1b2c4ad8 authored by Fardale's avatar Fardale

simply communication

parent 80d8e5da
......@@ -22,9 +22,9 @@ let cmd id delete addr port pass () =
let open PrintBox in
match
CCResult.guard (fun () ->
Serialization_j.query_data_of_string json)
Serialization_j.jobs_status_of_string json)
with
| Ok (`JOBS (jobs, running)) ->
| Ok (jobs, running) ->
let b_jobs =
Array.of_list jobs |> fun jobs ->
Array.init
......@@ -78,10 +78,6 @@ let cmd id delete addr port pass () =
Format.printf "Jobq:@,%a@.@.Running:@,%a@." PrintBox_text.pp
b_jobs PrintBox_text.pp b_running;
Lwt.return_unit
| Ok q ->
Logs_lwt.err (fun m ->
m "Error received the wrong answer: %s"
(Serialization_j.string_of_query_data q))
| Error e ->
Logs_lwt.err (fun m ->
m "Error during the reception of the answer: %s"
......
......@@ -250,12 +250,12 @@ let server_handler pass port sockaddr (ic, oc) =
List.map (fun (ip, (_, computations)) ->
( ip,
List.filter_map
(fun c -> if fst c.id = id then Some c else None)
(fun (c:computation) -> if fst c.id = id then Some c else None)
computations ))
in
Lwt_io.write_line oc
(Serialization_j.string_of_query_data
(`JOBS (jobs_list, running_list)))
(Serialization_j.string_of_jobs_status
(jobs_list, running_list))
>>= fun () -> Lwt_io.flush oc
| _ ->
Lwt_io.write_line oc
......
......@@ -17,9 +17,10 @@ type result =
type query_data = [ COMPUTATION of computation | JOBQ of (int option * bool)
| RESULT of result | JOB of submission
| JOBS of (job list * (string * computation list) list)
| STAT ]
type jobs_status = (job list * (string * computation list) list)
type stat = (int * int)
type query = (string * query_data)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment