libmuscle.endpoint module
- class libmuscle.endpoint.Endpoint(kernel: Reference, index: List[int], port: Identifier, slot: List[int])[source]
Bases:
object
Place that a message is sent from and to.
In the model description, we have kernels with ports connected by conduits. However, these kernels may be replicated, in which case there are many instances of them at run time. Thus, at run time there also need to be many conduit instances to connect the many kernel instances.
A conduit always connects a port on a kernel to another port on another kernel. A conduit instance connects an endpoint to another endpoint. An endpoint has the name of a kernel, its index, the name of a port on that kernel, and a slot. The kernel and port name of a sender or receiver of a conduit instance come from the corresponding conduit.
When a kernel is instantiated multiple times, the instances each have a unique index, which is a list of integers, to distinguish them from each other. Since a conduit instance connects kernel instances, each side will have an index to supply to the endpoint. The slot is an optional integer, like the index, and is passed when sending or receiving a message, and gives additional information on where to send the message.
For example, assume a single kernel named
abc
with portp1
which is connected to a portp2
on kerneldef
by a conduit, and of kerneldef
there are 10 instances. A message sent byabc
onp1
to the fourth instance ofdef
portp2
is sent from an endpoint with kernelabc
, index[]
, portp1
and slot3
, and received on an endpoint with kerneldef
, index[3]
, portp2
and slotNone
.Conduit instances are never actually created in the code, but Endpoints are.