libmuscle.peer_info module

class libmuscle.peer_info.PeerInfo(kernel: Reference, index: list[int], conduits: list[Conduit], peer_dims: dict[Reference, list[int]], peer_locations: dict[Reference, list[str]], ymmsl_ports: list[Port])[source]

Bases: object

Interprets information about peers for a Communicator

check_peer_dimensions(port_id: Identifier) list[int][source]

Checks peer dimensions are as expected.

Parameters:

port_id – Port to check peer dimensions for.

Returns:

Dimensions of connected peers.

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.

list_incoming_ports() list[tuple[Identifier, Reference]][source]

list incoming ports.

Returns:

A list of tuples containing a port id and a reference to the peer endpoint.

list_outgoing_ports() list[tuple[Identifier, list[Reference]]][source]

list outgoing ports.

Returns:

A list of tuples containing a port id and a list of references to the peer endpoint(s).

list_ymmsl_ports() list[Port][source]

list ports declared in the yMMSL configuration