9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-18 11:23:38 +01:00

Merge branch 'dev' of github.com:QuantumPackage/qp2 into dev

This commit is contained in:
Anthony Scemama 2021-02-17 23:40:02 +01:00
commit 6d4ed55229

View File

@ -681,7 +681,7 @@ integer function disconnect_from_taskserver(zmq_to_qp_run_socket, worker_id)
integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket
integer, intent(in) :: worker_id integer, intent(in) :: worker_id
integer, external :: disconnect_from_taskserver_state integer, external :: disconnect_from_taskserver_state
disconnect_from_taskserver = disconnect_from_taskserver_state(zmq_to_qp_run_socket, worker_id, zmq_state(1:128)) disconnect_from_taskserver = disconnect_from_taskserver_state(zmq_to_qp_run_socket, worker_id, zmq_state)
end end
integer function disconnect_from_taskserver_state(zmq_to_qp_run_socket, worker_id, state) integer function disconnect_from_taskserver_state(zmq_to_qp_run_socket, worker_id, state)
@ -692,10 +692,11 @@ integer function disconnect_from_taskserver_state(zmq_to_qp_run_socket, worker_i
END_DOC END_DOC
integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket
integer, intent(in) :: worker_id integer, intent(in) :: worker_id
character*(128), intent(in) :: state
integer :: rc, sze integer :: rc, sze
character*(512) :: message, reply character*(512) :: message, reply
character*(128) :: state character*(128) :: state_tmp
disconnect_from_taskserver_state = 0 disconnect_from_taskserver_state = 0
@ -712,8 +713,8 @@ integer function disconnect_from_taskserver_state(zmq_to_qp_run_socket, worker_i
rc = f77_zmq_recv(zmq_to_qp_run_socket, message, 510, 0) rc = f77_zmq_recv(zmq_to_qp_run_socket, message, 510, 0)
message = trim(message(1:rc)) message = trim(message(1:rc))
read(message,*, end=10, err=10) reply, state read(message,*, end=10, err=10) reply, state_tmp
if ((trim(reply) == 'disconnect_reply').and.(trim(state) == trim(zmq_state))) then if ((trim(reply) == 'disconnect_reply').and.(trim(state_tmp) == trim(state))) then
return return
endif endif
if (trim(message) == 'error Wrong state') then if (trim(message) == 'error Wrong state') then
@ -905,17 +906,17 @@ integer function get_task_from_taskserver(zmq_to_qp_run_socket,worker_id,task_id
return return
endif endif
message = repeat(' ',512) message = repeat(' ',1024)
rc = f77_zmq_recv(zmq_to_qp_run_socket, message, 1024, 0) rc = f77_zmq_recv(zmq_to_qp_run_socket, message, 1024, 0)
rc = min(1024,rc) rc = min(1024,rc)
read(message(1:rc),*, end=10, err=10) reply read(message(1:rc),*, end=10, err=10) reply
if (trim(reply) == 'get_task_reply') then if (trim(reply) == 'get_task_reply') then
read(message(1:rc),*, end=10, err=10) reply, task_id read(message(1:rc),*, end=10, err=10) reply, task_id
rc = 15 rc = 15
do while (message(rc:rc) == ' ') do while (rc < 1024 .and. message(rc:rc) == ' ')
rc += 1 rc += 1
enddo enddo
do while (message(rc:rc) /= ' ') do while (rc < 1024 .and. message(rc:rc) /= ' ')
rc += 1 rc += 1
enddo enddo
rc += 1 rc += 1