libmuscle.mcp.direct_server module

class libmuscle.mcp.direct_server.DirectServer(instance_id: Reference, post_office: PostOffice)[source]

Bases: Server

A server that server within this program

This server is for connecting compute element instances within the same process.

Create a DirectServer.

Parameters
  • instance_id – Id of the instance we’re a server for.

  • post_office – A PostOffice to obtain messages from, for servicing requests.

close() None[source]

Closes this server.

Since we have no network connections or other resources, this is a no-op.

get_location() str[source]

Returns the location this server listens on.

Returns

A string containing the location.

request(receiver: Reference) bytes[source]

Gets the next message for this receiver from its outbox.

This will block until a message is available.

Parameters

receiver – The receiver requesting the next message.

Returns

The next message.