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
- close() None [source]¶
Close the connection
This closes the connection. After this no other member functions can be called.
- deregister_instance(name: ymmsl.identity.Reference) None [source]¶
Deregister a component instance with the manager.
- Parameters
name – Name of the instance in the simulation.
- get_settings() ymmsl.settings.Settings [source]¶
Get the central settings from the manager.
- Returns
The requested settings.
- register_instance(name: ymmsl.identity.Reference, locations: List[str], ports: List[ymmsl.component.Port]) None [source]¶
Register a component 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: ymmsl.identity.Reference) Tuple[List[ymmsl.model.Conduit], Dict[ymmsl.identity.Reference, List[int]], Dict[ymmsl.identity.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: libmuscle.logging.LogMessage) None [source]¶
Send a log message to the manager.
- Parameters
message – The message to send.
- submit_profile_events(events: Iterable[libmuscle.profiling.ProfileEvent]) None [source]¶
Sends profiling events to the manager.
- Parameters
events – The events to send.
- libmuscle.mmp_client.encode_operator(op: ymmsl.component.Operator) str [source]¶
Convert an Operator to a MsgPack-compatible value.
- libmuscle.mmp_client.encode_port(port: ymmsl.component.Port) List[str] [source]¶
Convert a Port to a MsgPack-compatible value.
- libmuscle.mmp_client.encode_profile_event(event: libmuscle.profiling.ProfileEvent) Any [source]¶
Converts a ProfileEvent to a list.
- Parameters
event – A profile event
- Returns
A list with its attributes, for MMP serialisation.