Skip to main content

prefect.server.events.models.composite_trigger_child_firing

Functions

acquire_composite_trigger_lock

acquire_composite_trigger_lock(session: AsyncSession, trigger: CompositeTrigger) -> None
Acquire a transaction-scoped advisory lock for the given composite trigger. This serializes concurrent child trigger evaluations for the same compound trigger, preventing a race condition where multiple transactions each see only their own child firing and neither fires the parent. The lock is automatically released when the transaction commits or rolls back.

upsert_child_firing

upsert_child_firing(db: PrefectDBInterface, session: AsyncSession, firing: Firing)

get_child_firings

get_child_firings(db: PrefectDBInterface, session: AsyncSession, trigger: CompositeTrigger) -> Sequence['ORMCompositeTriggerChildFiring']

clear_old_child_firings

clear_old_child_firings(db: PrefectDBInterface, session: AsyncSession, trigger: CompositeTrigger, fired_before: DateTime) -> None

clear_child_firings

clear_child_firings(db: PrefectDBInterface, session: AsyncSession, trigger: CompositeTrigger, firing_ids: Sequence[UUID]) -> set[UUID]
Delete the specified child firings and return the IDs that were actually deleted. Returns the set of child_firing_ids that were successfully deleted. Callers can compare this to the expected firing_ids to detect races and avoid double-firing composite triggers.