EclypseMPI#

class eclypse.remote.communication.mpi.interface.EclypseMPI[source]#

Bases: EclypseCommunicationInterface

EclypseMPI class.

It implements the MPI communication protocol among services in the same application, deployed within the same infrastructure.

It allows to send and receive messages among services, and to broadcast messages as well. The protocol is implemented by using the MPIRequest objects, which employ asynchrony to handle the simulation of communication costs of interactions.

Methods

__init__(service)

Initializes the MPI interface.

bcast(body[, timestamp])

Broadcasts a message to all neighbor services.

recv()

Receive a message in the input queue.

send(recipient_ids, body[, timestamp])

Sends a message to a single recipient or multiple recipients.

Attributes

__init__(service)[source]#

Initializes the MPI interface.

Parameters:

service (Service) – The service that uses the MPI interface.

send(recipient_ids, body, timestamp=None)[source]#

Sends a message to a single recipient or multiple recipients.

When awaited, the total wait time is the communication cost between the sender and the recipient in the case of a unicast, and the maximum communication cost among the interactions with the recipients in the case of a multicast. The result of this method must be awaited.

Parameters:
  • recipient_ids (str | list[str] | None) – The ids of the recipients. If a single id is specified, the message is sent to a single recipient. If a list of ids is specified, the message is sent to multiple recipients.

  • body (dict[str, Any]) – The data to be sent. It must be a pickleable object.

  • timestamp (datetime.datetime | None, optional) – The timestamp of the message. Defaults to datetime.datetime.now().

Returns:

The MPI request.

Return type:

UnicastRequest | MulticastRequest

bcast(body, timestamp=None)[source]#

Broadcasts a message to all neighbor services.

When awaited, the total wait time is the maximum communication cost among the interactions with neighbours. The result of this method must be awaited.

Parameters:
  • body (Any) – The data to be sent. It must be a pickleable object.

  • timestamp (datetime.datetime | None, optional) – The timestamp of the message. Defaults to datetime.datetime.now().

Returns:

The Broadcast MPI request.

Return type:

BroadcastRequest

recv()[source]#

Receive a message in the input queue.

The result of this method must be awaited.

Returns:

The message in the input queue.

Return type:

Task[Any]