Skip to main content

prefect.server.events.services.event_persister

The event persister moves event messages from the event bus to storage storage as fast as it can. Never gets tired.

Functions

create_handler

Set up a message handler that will accumulate and send events to the database every batch_size messages, or every flush_every interval to flush any remaining messages. Event trimming/retention is handled by the db_vacuum service (vacuum_old_events and vacuum_events_with_retention_overrides tasks). Args:
  • batch_size: Number of events to accumulate before flushing
  • flush_every: Maximum time between flushes
  • queue_max_size: Maximum events in queue before dropping new events
  • max_flush_retries: Consecutive flush failures before dropping events

Classes

EventPersister

A service that persists events to the database as they arrive. Methods:

all_services

Get list of all service classes

enabled

Whether the service is enabled

enabled_services

Get list of enabled service classes

environment_variable_name

run_services

Run enabled services until cancelled.

running

A context manager that runs enabled services on entry and stops them on exit.

service_settings

service_settings

The Prefect setting that controls whether the service is enabled

start

start

Start running the service, which may run indefinitely

started_event

started_event

stop

stop

Stop the service