libmuscle.mmp_client module

class libmuscle.mmp_client.MMPClient(location: str)[source]

Bases: object

The client for the MUSCLE Manager Protocol.

This class connects to the Manager and communicates with it on behalf of the rest of libmuscle.

It manages the connection, and converts between our native types and the gRPC generated types.

Create an MMPClient.

Parameters

location – A connection string of the form hostname:port

deregister_instance(name: Reference) None[source]

Deregister a compute element instance with the manager.

Parameters

name – Name of the instance in the simulation.

get_settings() Settings[source]

Get the central settings from the manager.

Returns

The requested settings.

register_instance(name: Reference, locations: List[str], ports: List[Port]) None[source]

Register a compute element instance with the manager.

Parameters
  • name – Name of the instance in the simulation.

  • locations – List of places where the instance can be reached.

  • ports – List of ports of this instance.

request_peers(name: Reference) Tuple[List[Conduit], Dict[Reference, List[int]], Dict[Reference, List[str]]][source]

Request connection information about peers.

This will repeat the request at an exponentially increasing query interval at first, until it reaches the interval specified by PEER_INTERVAL_MIN and PEER_INTERVAL_MAX. From there on, intervals are drawn randomly from that range.

Parameters

name – Name of the current instance.

Returns

A tuple containing a list of conduits that this instance is attached to, a dictionary of peer dimensions, which is indexed by Reference to the peer kernel, and specifies how many instances of that kernel there are, and a dictionary of peer instance locations, indexed by Reference to a peer instance, and containing for each peer instance a list of network location strings at which it can be reached.

submit_log_message(message: LogMessage) None[source]

Send a log message to the manager.

Parameters

message – The message to send.

submit_profile_events(events: Iterable[ProfileEvent]) None[source]

Sends profiling events to the manager.

Parameters

events – The events to send.

libmuscle.mmp_client.conduit_from_grpc(conduit: Conduit) Conduit[source]

Converts a Conduit from grpc to ymmsl.

Parameters

conduit – A conduit.

Returns

The same conduit, as ymmsl.Conduit.