libmuscle.manager.mmp_server module

class libmuscle.manager.mmp_server.MMPRequestHandler(logger: Logger, profile_store: ProfileStore, configuration: Configuration, instance_registry: InstanceRegistry, topology_store: TopologyStore, snapshot_registry: SnapshotRegistry, deadlock_detector: DeadlockDetector, run_dir: RunDir | None)[source]

Bases: RequestHandler

Handles Manager requests.

close() None[source]

Free per-thread resources.

On shutdown of the server, this will be called by each server thread before it shuts down.

handle_request(request: Buffer) Buffer[source]

Handles a manager request.

Parameters:

request – The encoded request

Returns:

An encoded response

Return type:

response

class libmuscle.manager.mmp_server.MMPServer(logger: Logger, profile_store: ProfileStore, configuration: Configuration, instance_registry: InstanceRegistry, topology_store: TopologyStore, snapshot_registry: SnapshotRegistry, deadlock_detector: DeadlockDetector, run_dir: RunDir | None)[source]

Bases: object

The MUSCLE Manager Protocol server.

This class accepts connections from the instances comprising the multiscale model to be executed, and services them using an MMPRequestHandler.

get_location() str[source]

Returns this server’s network location.

This is a string of the form tcp:<hostname>:<port>.

stop() None[source]

Stops the server.

This makes the server stop serving requests, and shuts down its background threads. By the time this gets called, the instances are down, so we don’t need to wait for any sessions to time out.

libmuscle.manager.mmp_server.decode_operator(data: str) Operator[source]

Create an Operator from a MsgPack-compatible value.

libmuscle.manager.mmp_server.decode_port(data: List[str]) Port[source]

Create a Port from a MsgPack-compatible value.

libmuscle.manager.mmp_server.encode_checkpoint_rule(rule: CheckpointRule) Dict[str, Any][source]

Convert a CheckpointRule to a MsgPack-compatible value.

libmuscle.manager.mmp_server.encode_checkpoints(checkpoints: Checkpoints) Dict[str, Any][source]

Convert a Checkpoins to a MsgPack-compatible value.

libmuscle.manager.mmp_server.encode_conduit(conduit: Conduit) List[str][source]

Convert a Conduit to a MsgPack-compatible value.

libmuscle.manager.mmp_server.encode_ports(ports: Ports) list[list[str]][source]

Convert a Ports to a MsgPack-compatible value.