Back to Prefect

clients

docs/v3/api-ref/python/prefect-events-clients.mdx

3.6.30.dev37.8 KB
Original Source

prefect.events.clients

Functions

http_to_ws <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L89" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
http_to_ws(url: str) -> str

events_in_socket_from_api_url <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L93" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
events_in_socket_from_api_url(url: str) -> str

events_out_socket_from_api_url <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L97" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
events_out_socket_from_api_url(url: str) -> str

get_events_client <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L101" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
get_events_client(reconnection_attempts: int = 10, checkpoint_every: int = 700, checkpoint_interval: float = 30.0) -> 'EventsClient'

get_events_subscriber <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L136" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
get_events_subscriber(filter: Optional['EventFilter'] = None, reconnection_attempts: int = 10) -> 'PrefectEventSubscriber'

Classes

EventsClient <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L166" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

The abstract interface for all Prefect Events clients

Methods:

client_name <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L170" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
client_name(self) -> str

emit <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L173" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
emit(self, event: Event) -> None

Emit a single event

NullEventsClient <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L204" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

A Prefect Events client implementation that does nothing

Methods:

client_name <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L170" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
client_name(self) -> str

emit <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L173" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
emit(self, event: Event) -> None

Emit a single event

AssertingEventsClient <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L211" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

A Prefect Events client that records all events sent to it for inspection during tests.

Methods:

client_name <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L170" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
client_name(self) -> str

emit <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L173" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
emit(self, event: Event) -> None

Emit a single event

pop_events <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L235" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
pop_events(self) -> List[Event]

reset <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L229" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
reset(cls) -> None

Reset all captured instances and their events. For use between tests

PrefectEventsClient <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L263" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

A Prefect Events client that streams events to a Prefect server

Methods:

client_name <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L170" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
client_name(self) -> str

emit <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L173" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
emit(self, event: Event) -> None

Emit a single event

AssertingPassthroughEventsClient <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L553" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

A Prefect Events client that BOTH records all events sent to it for inspection during tests AND sends them to a Prefect server.

Methods:

pop_events <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L576" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
pop_events(self) -> list[Event]

reset <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L572" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
reset(cls) -> None

PrefectCloudEventsClient <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L594" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

A Prefect Events client that streams events to a Prefect Cloud Workspace

PrefectEventSubscriber <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L640" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Subscribes to a Prefect event stream, yielding events as they occur.

Example:

from prefect.events.clients import PrefectEventSubscriber
from prefect.events.filters import EventFilter, EventNameFilter

filter = EventFilter(event=EventNameFilter(prefix=["prefect.flow-run."]))

async with PrefectEventSubscriber(filter=filter) as subscriber:
    async for event in subscriber:
        print(event.occurred, event.resource.id, event.event)

Methods:

client_name <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L707" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
client_name(self) -> str

PrefectCloudEventSubscriber <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L858" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Methods:

client_name <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L707" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
client_name(self) -> str

PrefectCloudAccountEventSubscriber <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/clients.py#L884" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>