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)
| 678 | |
| 679 | |
| 680 | def 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 | |
| 714 | def send_response(target, response, group_id): |
nothing calls this directly
no test coverage detected