mirror of
https://github.com/LCPQ/quantum_package
synced 2025-01-03 18:16:12 +01:00
Almost working
This commit is contained in:
parent
3bd401513d
commit
eaee625df4
@ -248,16 +248,20 @@ end
|
|||||||
(** GetTaskReply : Reply to the GetTask message *)
|
(** GetTaskReply : Reply to the GetTask message *)
|
||||||
module GetTaskReply_msg : sig
|
module GetTaskReply_msg : sig
|
||||||
type t
|
type t
|
||||||
val create : task_id:Id.Task.t -> task:string -> t
|
val create : task_id:Id.Task.t option -> task:string option -> t
|
||||||
val to_string : t -> string
|
val to_string : t -> string
|
||||||
end = struct
|
end = struct
|
||||||
type t =
|
type t =
|
||||||
{ task_id: Id.Task.t ;
|
{ task_id: Id.Task.t option ;
|
||||||
task : string ;
|
task : string option ;
|
||||||
}
|
}
|
||||||
let create ~task_id ~task = { task_id ; task }
|
let create ~task_id ~task = { task_id ; task }
|
||||||
let to_string x =
|
let to_string x =
|
||||||
Printf.sprintf "get_task_reply %d %s" (Id.Task.to_int x.task_id) x.task
|
match x.task_id, x.task with
|
||||||
|
| Some task_id, Some task ->
|
||||||
|
Printf.sprintf "get_task_reply %d %s" (Id.Task.to_int task_id) task
|
||||||
|
| _ ->
|
||||||
|
Printf.sprintf "get_task_reply 0"
|
||||||
end
|
end
|
||||||
|
|
||||||
(** GetPsi : get the current variational wave function *)
|
(** GetPsi : get the current variational wave function *)
|
||||||
|
@ -99,9 +99,12 @@ let del_task ~task_id q =
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
let number_of_queued q =
|
let number q =
|
||||||
Map.length q.tasks
|
Map.length q.tasks
|
||||||
|
|
||||||
|
let number_of_queued q =
|
||||||
|
List.length q.queued
|
||||||
|
|
||||||
let number_of_running q =
|
let number_of_running q =
|
||||||
Map.length q.running
|
Map.length q.running
|
||||||
|
|
||||||
|
@ -305,8 +305,7 @@ let del_task msg program_state rep_socket =
|
|||||||
}
|
}
|
||||||
in
|
in
|
||||||
let more =
|
let more =
|
||||||
(Queuing_system.number_of_queued new_program_state.queue +
|
(Queuing_system.number new_program_state.queue > 0)
|
||||||
Queuing_system.number_of_running new_program_state.queue) > 0
|
|
||||||
in
|
in
|
||||||
Message.DelTaskReply (Message.DelTaskReply_msg.create ~task_id ~more)
|
Message.DelTaskReply (Message.DelTaskReply_msg.create ~task_id ~more)
|
||||||
|> Message.to_string
|
|> Message.to_string
|
||||||
@ -427,21 +426,10 @@ let get_task msg program_state rep_socket pair_socket =
|
|||||||
}
|
}
|
||||||
in
|
in
|
||||||
|
|
||||||
match (task, task_id) with
|
Message.GetTaskReply (Message.GetTaskReply_msg.create ~task ~task_id)
|
||||||
| Some task, Some task_id ->
|
|> Message.to_string
|
||||||
begin
|
|> ZMQ.Socket.send rep_socket ;
|
||||||
Message.GetTaskReply (Message.GetTaskReply_msg.create ~task ~task_id)
|
new_program_state
|
||||||
|> Message.to_string
|
|
||||||
|> ZMQ.Socket.send rep_socket ;
|
|
||||||
new_program_state
|
|
||||||
end
|
|
||||||
| _ ->
|
|
||||||
begin
|
|
||||||
Message.Terminate (Message.Terminate_msg.create ())
|
|
||||||
|> Message.to_string
|
|
||||||
|> ZMQ.Socket.send rep_socket ;
|
|
||||||
program_state
|
|
||||||
end
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
@ -601,6 +589,7 @@ let start_pub_thread ~port =
|
|||||||
else
|
else
|
||||||
state
|
state
|
||||||
in
|
in
|
||||||
|
print_endline (string_of_pub_state new_state);
|
||||||
ZMQ.Socket.send pub_socket @@ string_of_pub_state new_state;
|
ZMQ.Socket.send pub_socket @@ string_of_pub_state new_state;
|
||||||
match state with
|
match state with
|
||||||
| Stopped -> ()
|
| Stopped -> ()
|
||||||
|
Loading…
Reference in New Issue
Block a user