Serialized RPC message that can be sent to remote processes. This class can be used as argument or return value for C API. Attributes ---------- service_id : int The remote service ID the message wishes to invoke. msg_seq : int Sequence number of this message.
| 558 | |
| 559 | @register_object("rpc.RPCMessage") |
| 560 | class RPCMessage(ObjectBase): |
| 561 | """Serialized RPC message that can be sent to remote processes. |
| 562 | |
| 563 | This class can be used as argument or return value for C API. |
| 564 | |
| 565 | Attributes |
| 566 | ---------- |
| 567 | service_id : int |
| 568 | The remote service ID the message wishes to invoke. |
| 569 | msg_seq : int |
| 570 | Sequence number of this message. |
| 571 | client_id : int |
| 572 | The client ID. |
| 573 | server_id : int |
| 574 | The server ID. |
| 575 | data : bytearray |
| 576 | Payload buffer carried by this request. |
| 577 | tensors : list[tensor] |
| 578 | Extra payloads in the form of tensors. |
| 579 | group_id : int |
| 580 | The group ID |
| 581 | """ |
| 582 | |
| 583 | def __init__( |
| 584 | self, |
| 585 | service_id, |
| 586 | msg_seq, |
| 587 | client_id, |
| 588 | server_id, |
| 589 | data, |
| 590 | tensors, |
| 591 | group_id=0, |
| 592 | ): |
| 593 | self.__init_handle_by_constructor__( |
| 594 | _CAPI_DGLRPCCreateRPCMessage, |
| 595 | int(service_id), |
| 596 | int(msg_seq), |
| 597 | int(client_id), |
| 598 | int(server_id), |
| 599 | data, |
| 600 | [F.zerocopy_to_dgl_ndarray(tsor) for tsor in tensors], |
| 601 | int(group_id), |
| 602 | ) |
| 603 | |
| 604 | @property |
| 605 | def service_id(self): |
| 606 | """Get service ID.""" |
| 607 | return _CAPI_DGLRPCMessageGetServiceId(self) |
| 608 | |
| 609 | @property |
| 610 | def msg_seq(self): |
| 611 | """Get message sequence number.""" |
| 612 | return _CAPI_DGLRPCMessageGetMsgSeq(self) |
| 613 | |
| 614 | @property |
| 615 | def client_id(self): |
| 616 | """Get client ID.""" |
| 617 | return _CAPI_DGLRPCMessageGetClientId(self) |
no outgoing calls