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:
objectInterprets 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.