Receive one response. Receive one :class:`RPCMessage` and de-serialize it into a proper Response object. The operation is blocking -- it returns when it receives any message or it times out. Parameters ---------- timeout : int, optional The timeout value in millise
(timeout=0)
| 792 | |
| 793 | |
| 794 | def recv_response(timeout=0): |
| 795 | """Receive one response. |
| 796 | |
| 797 | Receive one :class:`RPCMessage` and de-serialize it into a proper Response object. |
| 798 | |
| 799 | The operation is blocking -- it returns when it receives any message |
| 800 | or it times out. |
| 801 | |
| 802 | Parameters |
| 803 | ---------- |
| 804 | timeout : int, optional |
| 805 | The timeout value in milliseconds. If zero, wait indefinitely. |
| 806 | |
| 807 | Returns |
| 808 | ------- |
| 809 | res : Response |
| 810 | One response received from the target, or None if it times out. |
| 811 | |
| 812 | Raises |
| 813 | ------ |
| 814 | ConnectionError if there is any problem with the connection. |
| 815 | """ |
| 816 | msg = recv_rpc_message(timeout) |
| 817 | if msg is None: |
| 818 | return None |
| 819 | _, res_cls = SERVICE_ID_TO_PROPERTY[msg.service_id] |
| 820 | if res_cls is None: |
| 821 | raise DGLError( |
| 822 | "Got response message from service ID {}, " |
| 823 | "but no response class is registered.".format(msg.service_id) |
| 824 | ) |
| 825 | res = deserialize_from_payload(res_cls, msg.data, msg.tensors) |
| 826 | if msg.client_id != get_rank() and get_rank() != -1: |
| 827 | raise DGLError( |
| 828 | "Got response of request sent by client {}, " |
| 829 | "different from my rank {}!".format(msg.client_id, get_rank()) |
| 830 | ) |
| 831 | if msg.group_id != get_group_id(): |
| 832 | raise DGLError( |
| 833 | "Got response of request sent by group {}, " |
| 834 | "different from my group {}!".format(msg.group_id, get_group_id()) |
| 835 | ) |
| 836 | return res |
| 837 | |
| 838 | |
| 839 | def remote_call(target_and_requests, timeout=0): |
no test coverage detected