libmuscle.mcp.transport_client module
- class libmuscle.mcp.transport_client.TimeoutHandler[source]
Bases:
objectObject handling timeouts during
TransportClient.call().- 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
timeoutseconds have passed without a response from the peer.
- property timeout: float
Timeout (in seconds) after which
on_timeout()is called.
- class libmuscle.mcp.transport_client.TransportClient[source]
Bases:
objectA client that connects to an MCP server.
This is a base class for MCP Transport Clients. An MCP Transport Client connects to an MCP Transport Server over some communication protocol, requests messages from it, and returns responses.
- call(request: Buffer, timeout_handler: TimeoutHandler | None = None) Tuple[Buffer, Tuple[ProfileTimestamp, ProfileTimestamp, ProfileTimestamp]][source]
Send a request to the server and receive the response.
This is a blocking call. Besides the result, this function returns a tuple with three timestamps (floats in seconds since the epoch). These were taken when the function was first called, when data became available and the transfer started, and when the transfer stopped.
- Parameters:
request – The request to send
timeout_handler – Optional timeout handler. This is used for communication deadlock detection.
- Returns:
The received response, and the timestamps