libmuscle.peer_manager module

class libmuscle.peer_manager.PeerManager(kernel: Reference, index: List[int], conduits: List[Conduit], peer_dims: Dict[Reference, List[int]], peer_locations: Dict[Reference, List[str]])[source]

Bases: object

Manages information about peers for a Communicator

get_peer_dims(peer_kernel: Reference) List[int][source]

Get the dimensions of a peer kernel.

Parameters:

peer_kernel – The peer kernel whose dimensions to get.

get_peer_endpoints(port: Identifier, slot: List[int]) List[Endpoint][source]

Determine the peer endpoints for the given port and slot.

Parameters:
  • port – The port on our side to send or receive on.

  • slot – The slot to send or receive on.

Returns:

The peer endpoints.

get_peer_locations(peer_instance: Reference) List[str][source]

Get the locations of a peer instance.

There may be multiple, if the peer supports more than one

protocol.

Parameters:

peer_instance – The instance whose locations to get.

get_peer_ports(port: Identifier) List[Reference][source]

Get a reference for the peer ports.

Parameters:

port – Name of the port on this side.

is_connected(port: Identifier) bool[source]

Determine whether the given port is connected.

Parameters:

port – The port to check.