Class AMSMessage¶
Defined in File rmq.py
Inheritance Relationships¶
Base Type¶
public object
Class Documentation¶
- rmq.AMSMessage : public object
Represents a RabbitMQ incoming message from AMSLib. Attributes: body: The body of the message as received from RabbitMQ
Public Functions
- __init__(self, str body)¶
- __str__(self)¶
- __repr__(self)¶
- header_format(self)¶
This string represents the AMS format in Python pack format: See https://docs.python.org/3/library/struct.html#format-characters - 1 byte is the size of the header (here 12). Limit max: 255 - 2 bytes are the MPI rank (0 if AMS is not running with MPI). Limit max: 65535 - 2 bytes to store the size of the MSG domain name. Limit max: 65535 - 2 bytes are the input dimension. Limit max: 65535 - 2 bytes are the output dimension. Limit max: 65535 - 3 bytes are for aligning memory to 4 |_Header_|_Rank_|_DomainSize_|_InDim_|_OutDim_|_Pad_|_DomainName_|.Real_Data.| Then the data starts at byte 12 with the domain name, then the real data and is structured as pairs of input/outputs. Let K be the total number of elements, then we have K inputs followed by K outputs: |__Header_(12B)__|_Domain_Name_|__Input 1__|...|__Input_K__|__Output_1__|...
- endianness(self)¶
'=' means native endianness in standart size (system). See https://docs.python.org/3/library/struct.html#format-characters
- encode(self, int num_elem, str domain_name, int input_dim, int output_dim, int dtype_byte=4)¶
For debugging and testing purposes, this function encode a message identical to what AMS would send
- decode(self)¶