- Overview
- ContextTaskHandler
ContextTaskHandler
Part of Tasks in the Python API reference.
Related guidance: concepts/tasks, how-to/receive-local-tasks, how-to/dispatch-local-tasks, quickstarts/effector-handler.
Runnable examples: receive_task.py, dispatch_task.py, receive_mesh_task.py, dispatch_mesh_task.py.
from picogrid_ecn_client import ContextTaskHandlerHandle a validated task request together with its dispatch context.
class ContextTaskHandler(Protocol[RequestT_contra, ResultT_co]): ...__call__
Section titled “__call__”Invoke the handler with context and a validated request.
def __call__( context: TaskRequestContext, request: RequestT_contra, /,) -> Coroutine[Any, Any, ResultT_co | TaskResult[ResultT_co] | Mapping[str, JsonValue] | None]Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
| context | TaskRequestContext | — | Source, mode, and timing context for the request. |
| request | RequestT_contra | — | Request model validated before invocation. |
Returns
Section titled “Returns”| Type | Description |
|---|---|
| Coroutine[Any, Any, ResultT_co | TaskResult[ResultT_co] | Mapping[str, JsonValue] | None] | A coroutine resolving to a result model, task result, JSON mapping, or None. Registration rejects non-async callables, so the protocol requires a coroutine rather than any awaitable. |
Version 0.2.0 · branch main
