MCPcopy
hub / github.com/dmlc/dgl / send_request_to_machine

Function send_request_to_machine

python/dgl/distributed/rpc.py:680–711  ·  view source on GitHub ↗

Send one request to the target machine, which will randomly select a server node to process this request. The operation is non-blocking -- it does not guarantee the payloads have reached the target or even have left the sender process. However, all the payloads (i.e., data and array

(target, request)

Source from the content-addressed store, hash-verified

678
679
680def send_request_to_machine(target, request):
681 """Send one request to the target machine, which will randomly
682 select a server node to process this request.
683
684 The operation is non-blocking -- it does not guarantee the payloads have
685 reached the target or even have left the sender process. However,
686 all the payloads (i.e., data and arrays) can be safely freed after this
687 function returns.
688
689 Parameters
690 ----------
691 target : int
692 ID of target machine.
693 request : Request
694 The request to send.
695
696 Raises
697 ------
698 ConnectionError if there is any problem with the connection.
699 """
700 service_id = request.service_id
701 msg_seq = incr_msg_seq()
702 client_id = get_rank()
703 server_id = random.randint(
704 target * get_num_server_per_machine(),
705 (target + 1) * get_num_server_per_machine() - 1,
706 )
707 data, tensors = serialize_to_payload(request)
708 msg = RPCMessage(
709 service_id, msg_seq, client_id, server_id, data, tensors, get_group_id()
710 )
711 send_rpc_message(msg, server_id)
712
713
714def send_response(target, response, group_id):

Callers

nothing calls this directly

Calls 7

incr_msg_seqFunction · 0.85
serialize_to_payloadFunction · 0.85
RPCMessageClass · 0.85
get_group_idFunction · 0.85
send_rpc_messageFunction · 0.85
get_rankFunction · 0.70

Tested by

no test coverage detected