libmuscle.mpp_message module

class libmuscle.mpp_message.ClosePort[source]

Bases: object

Sentinel value to send when closing a port.

Sending an object of this class on a port/conduit conveys to the receiver the message that no further messages will be sent on this port during the simulation.

All information is carried by the type, this has no attributes.

class libmuscle.mpp_message.ExtTypeId(value)[source]

Bases: IntEnum

MessagePack extension type ids.

MessagePack lets you define your own types as an extension to the built-in ones. These are distinguished by a number from 0 to 127. This class is our registry of extension type ids.

CLOSE_PORT = 0
GRID_BOOL = 6
GRID_FLOAT32 = 4
GRID_FLOAT64 = 5
GRID_INT32 = 2
GRID_INT64 = 3
SETTINGS = 1
class libmuscle.mpp_message.MPPMessage(sender: Reference, receiver: Reference, port_length: int | None, timestamp: float, next_timestamp: float | None, settings_overlay: Settings, message_number: int, saved_until: float, data: Any)[source]

Bases: object

A MUSCLE Peer Protocol message.

Messages carry the identity of their sender and receiver, so that they can be routed by a MUSCLE Transport Overlay when we get to multi-site running in the future.

encoded() bytes[source]

Encode the message and return as a bytes buffer.

static from_bytes(message: bytes) MPPMessage[source]

Create an MPP Message from an encoded buffer.

Parameters:

message – MessagePack encoded message data.