libmuscle.receive_timeout_handler module

exception libmuscle.receive_timeout_handler.Deadlock[source]

Bases: Exception

Exception that is raised when the simulation has deadlocked.

class libmuscle.receive_timeout_handler.ReceiveTimeoutHandler(manager: MMPClient, peer_instance: Reference, port_name: str, slot: int | None, timeout: float)[source]

Bases: TimeoutHandler

Timeout handler when receiving messages from peers.

This handler sends a message to the Muscle Manager when the receive times out (and another message when the message does arrive).

This is used by the manager to detect if the simulation is in a deadlock, where a cycle of instances is waiting for each other.

on_receive() None[source]

Callback when receiving a response from the peer.

Note: this method is only called when the request has timed out.

on_timeout() None[source]

Callback when timeout seconds have passed without a response from the peer.

property timeout: float

Timeout (in seconds) after which on_timeout() is called.