GitHub

RunnersService

API reference for RunnersService.

Pings runners, sends them messages and tells them a persisted message is waiting. send_local and notify_local deliver to this runner's entities, through storage when the message is persisted.

Functions

ping

ping(address) -> Effect[None, RunnerUnavailable]

Checks that the runner at address answers; fails with RunnerUnavailable when it cannot be reached.

ParameterTypeDescription
addressRunnerAddress

Returns Effect[None, RunnerUnavailable]

def ping(self, address: RunnerAddress, /) -> Effect[None, RunnerUnavailable]:
    """Checks that the runner at ``address`` answers; fails with
    ``RunnerUnavailable`` when it cannot be reached."""
    ...

send_local

send_local(message, /, *, send, simulate_remote_serialization) -> Effect[None, LocalSendError | PersistenceError]

Delivers message to an entity of this runner through send, first encoding and decoding it as a remote send would when simulate_remote_serialization is set (a message that does not survive that gets a defect reply). Fails as send does: EntityNotAssignedToRunner, MailboxFull or AlreadyProcessingMessage.

ParameterTypeDescription
messageOutgoing
sendSendLocalFn
simulate_remote_serializationbool

Returns Effect[None, LocalSendError | PersistenceError]

def send_local(
    self, message: Outgoing, /, *, send: SendLocalFn, simulate_remote_serialization: bool
) -> Effect[None, LocalSendError | PersistenceError]:
    """Delivers ``message`` to an entity of this runner through
    ``send``, first encoding and decoding it as a remote send would
    when ``simulate_remote_serialization`` is set (a message that does
    not survive that gets a defect reply). Fails as ``send`` does:
    ``EntityNotAssignedToRunner``, ``MailboxFull`` or
    ``AlreadyProcessingMessage``."""
    ...

send

send(address, message) -> Effect[None, SendError]

Sends message to the runner at address, its replies going to the message's respond. Fails with a SendError: RunnerUnavailable when the runner cannot be reached, or the error the remote runner gave.

ParameterTypeDescription
addressRunnerAddress
messageOutgoing

Returns Effect[None, SendError]

def send(self, address: RunnerAddress, message: Outgoing, /) -> Effect[None, SendError]:
    """Sends ``message`` to the runner at ``address``, its replies
    going to the message's ``respond``. Fails with a ``SendError``:
    ``RunnerUnavailable`` when the runner cannot be reached, or the
    error the remote runner gave."""
    ...

notify

notify(address, message, /, *, discard) -> Effect[None, SendError]

Tells the runner at address (None: not known) that message is waiting, saving it to MessageStorage first when it is persisted; unless discard, a request's replies are then recovered from storage. Fails with a SendError (PersistenceError when saving fails).

ParameterTypeDescription
addressRunnerAddress | None
messageOutgoing
discardbool

Returns Effect[None, SendError]

def notify(
    self, address: RunnerAddress | None, message: Outgoing, /, *, discard: bool
) -> Effect[None, SendError]:
    """Tells the runner at ``address`` (``None``: not known) that
    ``message`` is waiting, saving it to ``MessageStorage`` first when
    it is persisted; unless ``discard``, a request's replies are then
    recovered from storage. Fails with a ``SendError``
    (``PersistenceError`` when saving fails)."""
    ...

notify_local

notify_local(message, /, *, notify, discard, storage_only=False) -> Effect[None, PersistenceError]

Tells an entity of this runner through notify that message is waiting (ignoring EntityNotAssignedToRunner), saving it to MessageStorage first when it is persisted; unless discard, a request's replies then come back through storage (with storage_only, only by polling it). Fails with PersistenceError when saving fails.

ParameterTypeDescription
messageOutgoing
notifyNotifyLocalFn
discardbool
storage_onlybool = False

Returns Effect[None, PersistenceError]

def notify_local(
    self,
    message: Outgoing,
    /,
    *,
    notify: NotifyLocalFn,
    discard: bool,
    storage_only: bool = False,
) -> Effect[None, PersistenceError]:
    """Tells an entity of this runner through ``notify`` that
    ``message`` is waiting (ignoring ``EntityNotAssignedToRunner``),
    saving it to ``MessageStorage`` first when it is persisted; unless
    ``discard``, a request's replies then come back through storage
    (with ``storage_only``, only by polling it). Fails with
    ``PersistenceError`` when saving fails."""
    ...

on_runner_unavailable

on_runner_unavailable(address) -> Effect[None]

Marks the runner at address unavailable, dropping its connection; never fails.

ParameterTypeDescription
addressRunnerAddress

Returns Effect[None]

def on_runner_unavailable(self, address: RunnerAddress, /) -> Effect[None]:
    """Marks the runner at ``address`` unavailable, dropping its
    connection; never fails."""
    ...