Skip to content

watch_detections

Part of Reusable workflows in the Python API reference.

Related guidance: shipped-tooling.

Runnable examples: watch_detections.py.

from picogrid_ecn_client.workflows import watch_detections

Collect detection events, with zero meaning an intentionally unbounded watch.

async def watch_detections(
client: ECNClient,
*,
integration: str | None = None,
limit: int = 0,
on_event: Callable[[EntityEvent], None] | None = None,
) -> WatchEntitiesResult
NameTypeDefaultDescription
clientECNClientConfigured SDK client used to open the entity stream.
integrationstr | NoneNoneOptional exact integration name to observe.
limitint0Maximum events to collect; zero watches until interrupted while retaining only the most recent configured watcher buffer.
on_eventCallable[[EntityEvent], None] | NoneNoneOptional synchronous callback invoked for every observed event.
TypeDescription
WatchEntitiesResultAll events from a positive-limit watch, or the most recently retained events from an unbounded watch.
ExceptionDescription
ValidationErrorIf limit is negative or integration is empty.
ECNClientErrorIf the stream cannot be opened or consumed.

Source · workflows/observe.py

Version 0.2.0 · branch main