Skip to content

receive_mesh_task

Part of Reusable workflows in the Python API reference.

Related guidance: shipped-tooling.

Runnable examples: receive_mesh_task.py.

from picogrid_ecn_client.workflows import receive_mesh_task

Register an echo handler for a terminal-addressed deployment route.

async def receive_mesh_task(
client: ECNClient,
*,
terminal_id: UUID,
entity_id: UUID,
command: str,
task_limit: int = 0,
on_event: Callable[[TaskRequestContext], None] | None = None,
on_registered: Callable[[TaskRegistration], None] | None = None,
) -> ReceiveMeshTaskResult
NameTypeDefaultDescription
clientECNClientConfigured SDK client used to register the handler.
terminal_idUUIDLocal terminal identity that must match the client configuration.
entity_idUUIDCanonical identity that owns the task handler.
commandstrExact command name accepted by the handler.
task_limitint0Requests to handle before cleanup; zero waits until interrupted while retaining only the most recent configured watcher buffer.
on_eventCallable[[TaskRequestContext], None] | NoneNoneOptional callback invoked for every accepted request context.
on_registeredCallable[[TaskRegistration], None] | NoneNoneOptional callback invoked after registration succeeds.
TypeDescription
ReceiveMeshTaskResultTerminal identity and registration metadata plus all positive-limit requests, or the most recently retained contexts and results from an unbounded receiver.
ExceptionDescription
ValidationErrorIf terminal_id mismatches, task_limit is negative, a request arrives from a source other than a canonical source terminal, or a request arrives after the configured limit has been accepted.
ECNClientErrorIf registration, request handling, or cleanup fails.

Source · workflows/tasks.py

Version 0.2.0 · branch main