Send one request to the target server. Serialize the given request object to an :class:`RPCMessage` and send it out. 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.
(target, request)
| 639 | |
| 640 | |
| 641 | def send_request(target, request): |
| 642 | """Send one request to the target server. |
| 643 | |
| 644 | Serialize the given request object to an :class:`RPCMessage` and send it |
| 645 | out. |
| 646 | |
| 647 | The operation is non-blocking -- it does not guarantee the payloads have |
| 648 | reached the target or even have left the sender process. However, |
| 649 | all the payloads (i.e., data and arrays) can be safely freed after this |
| 650 | function returns. |
| 651 | |
| 652 | Parameters |
| 653 | ---------- |
| 654 | target : int |
| 655 | ID of target server. |
| 656 | request : Request |
| 657 | The request to send. |
| 658 | |
| 659 | Raises |
| 660 | ------ |
| 661 | ConnectionError if there is any problem with the connection. |
| 662 | """ |
| 663 | service_id = request.service_id |
| 664 | msg_seq = incr_msg_seq() |
| 665 | client_id = get_rank() |
| 666 | server_id = target |
| 667 | data, tensors = serialize_to_payload(request) |
| 668 | msg = RPCMessage( |
| 669 | service_id, |
| 670 | msg_seq, |
| 671 | client_id, |
| 672 | server_id, |
| 673 | data, |
| 674 | tensors, |
| 675 | group_id=get_group_id(), |
| 676 | ) |
| 677 | send_rpc_message(msg, server_id) |
| 678 | |
| 679 | |
| 680 | def send_request_to_machine(target, request): |
no test coverage detected