libmuscle.mcp.pipe_multiplexer module

libmuscle.mcp.pipe_multiplexer.add_instance(instance_id: Reference) None[source]

Adds pipes for an instance.

Parameters

instance_id – Name of the new instance.

libmuscle.mcp.pipe_multiplexer.can_communicate_for(instance_id: Reference) bool[source]

Returns whether we can serve on pipes for this instance.

If the instance was not started via Muscle3, then it will not be registered, and we cannot start a PipeServer for it. That’s fine, but we need to know.

Parameters

instance_id – Name of the requested instance.

libmuscle.mcp.pipe_multiplexer.can_connect_to(peer_address: str) bool[source]

Checks whether this multiplexer can make connections for the address.

This does not check whether the peer is up and running and listening, just that it’s in the right process tree.

Parameters

peer_address – An address of the form <uuid>/<instance_id>.

libmuscle.mcp.pipe_multiplexer.close_all_pipes() None[source]

Closes all the instance pipes.

For example, because each instance process and the mux process have their own copies, so the main process doesn’t need them and its copies should be closed.

libmuscle.mcp.pipe_multiplexer.close_instance_ends(instance_id: Reference) None[source]

Closes the instance sides of the pipes for the given instance.

Parameters

instance_id – The instance to close for.

libmuscle.mcp.pipe_multiplexer.close_mux_ends(instance_id: Reference) None[source]

Closes the mux sides of the pipes for the given instance.

Parameters

instance_id – The instance to close for.

libmuscle.mcp.pipe_multiplexer.get_address_for(instance_id: Reference) str[source]

Returns the MUSCLE-address for the given instance.

Parameters

instance_id – Id of the instance to get the address for.

Returns

An address string that can be passed to the MUSCLE Manager.

libmuscle.mcp.pipe_multiplexer.get_instance_client_conn(instance_id: Reference) Connection[source]

Returns the instance side of the client pipe for this instance.

Parameters

instance_id – The instance for which to get the pipe.

Returns

The instance side of the client pipe.

libmuscle.mcp.pipe_multiplexer.get_instance_server_conn(instance_id: Reference) Connection[source]

Returns the instance side of the server pipe for this instance.

Parameters

instance_id – The instance for which to get the pipe.

Returns

The instance side of the server pipe.

libmuscle.mcp.pipe_multiplexer.run() None[source]

Runs the pipe-based communication multiplexer.

This listens for connection requests from instances, and creates pipes between the requested instances so that they can exchange messages.

Shuts down automatically when all client instances have shut down.