Skip to main content

prefect.server.events.models.automation_held_events

Held expect events for proactive triggers with after. Events for one bucketing key can be evaluated in any order, so an expect event can be evaluated before the after event that opens its window, or counted in one window before a later after event rolls it. Every expect-only event is held here, and each bucket that opens or rolls counts the held events that occurred inside its window.

Functions

slot_start

The start of the slot that contains occurred, where slots are width wide and aligned to the epoch

holds_expect_events

Whether the trigger holds its expect-only events for the buckets that open later

acquire_bucketing_key_lock

Acquire a transaction-scoped lock on one bucketing key of a trigger. The lock is released when the transaction commits or rolls back.

is_held

Whether the event is already held for this trigger and key

hold_event

Hold the event for the buckets that open later, and drop held events for the same key that are too old or that no window needs to meet its threshold

held_events_in_window

A scalar subquery counting the events held for this trigger and key that occurred in the window from start (inclusive) to end (exclusive)

sweep_held_events

Delete every held event that was held more than HELD_EXPECT_EVENTS_RETENTION before now, unless a bucket for its key has not ended by now