prefect.server.events.schemas.automations

Classes

Posture

Methods:

auto

auto() -> str
Exposes enum.auto() to avoid requiring a second import to use AutoEnum

TriggerState

Methods:

auto

auto() -> str
Exposes enum.auto() to avoid requiring a second import to use AutoEnum

Trigger

Base class describing a set of criteria that must be satisfied in order to trigger an automation. Methods:

all_triggers

all_triggers(self) -> Sequence[Trigger]
Returns all triggers within this trigger

automation

automation(self) -> 'Automation'

create_automation_state_change_event

create_automation_state_change_event(self, firing: 'Firing', trigger_state: TriggerState) -> ReceivedEvent

model_validate_list

model_validate_list(cls, obj: Any) -> list[Self]

parent

parent(self) -> 'Union[Trigger, Automation]'

reset_fields

reset_fields(self: Self) -> Self
Reset the fields of the model that are in the _reset_fields set. Returns:
  • A new instance of the model with the reset fields.

reset_ids

reset_ids(self) -> None
Resets the ID of this trigger and all of its children

CompositeTrigger

Requires some number of triggers to have fired within the given time period. Methods:

actions

actions(self) -> List[ActionTypes]

all_triggers

all_triggers(self) -> Sequence[Trigger]

as_automation

as_automation(self) -> 'AutomationCore'

child_trigger_ids

child_trigger_ids(self) -> List[UUID]

create_automation_state_change_event

create_automation_state_change_event(self, firing: Firing, trigger_state: TriggerState) -> ReceivedEvent
Returns a ReceivedEvent for an automation state change into a triggered or resolved state.

describe_for_cli

describe_for_cli(self, indent: int = 0) -> str
Return a human-readable description of this trigger for the CLI

num_expected_firings

num_expected_firings(self) -> int

owner_resource

owner_resource(self) -> Optional[str]

ready_to_fire

ready_to_fire(self, firings: Sequence['Firing']) -> bool

set_deployment_id

set_deployment_id(self, deployment_id: UUID) -> None

CompoundTrigger

A composite trigger that requires some number of triggers to have fired within the given time period Methods:

num_expected_firings

num_expected_firings(self) -> int

ready_to_fire

ready_to_fire(self, firings: Sequence['Firing']) -> bool

validate_require

validate_require(self) -> Self

SequenceTrigger

A composite trigger that requires some number of triggers to have fired within the given time period in a specific order Methods:

expected_firing_order

expected_firing_order(self) -> List[UUID]

ready_to_fire

ready_to_fire(self, firings: Sequence['Firing']) -> bool

ResourceTrigger

Base class for triggers that may filter by the labels of resources. Methods:

actions

actions(self) -> List[ActionTypes]

as_automation

as_automation(self) -> 'AutomationCore'

covers_resources

covers_resources(self, resource: Resource, related: Sequence[RelatedResource]) -> bool

describe_for_cli

describe_for_cli(self, indent: int = 0) -> str
Return a human-readable description of this trigger for the CLI

owner_resource

owner_resource(self) -> Optional[str]

set_deployment_id

set_deployment_id(self, deployment_id: UUID) -> None

EventTrigger

A trigger that fires based on the presence or absence of events within a given period of time. Methods:

bucketing_key

bucketing_key(self, event: ReceivedEvent) -> Tuple[str, ...]

covers

covers(self, event: ReceivedEvent) -> bool

create_automation_state_change_event

create_automation_state_change_event(self, firing: Firing, trigger_state: TriggerState) -> ReceivedEvent
Returns a ReceivedEvent for an automation state change into a triggered or resolved state.

enforce_minimum_within_for_proactive_triggers

enforce_minimum_within_for_proactive_triggers(cls, data: Dict[str, Any] | Any) -> Dict[str, Any]

event_pattern

event_pattern(self) -> re.Pattern[str]
A regular expression which may be evaluated against any event string to determine if this trigger would be interested in the event

expects

expects(self, event: str) -> bool

immediate

immediate(self) -> bool
Does this reactive trigger fire immediately for all events?

meets_threshold

meets_threshold(self, event_count: int) -> bool

starts_after

starts_after(self, event: str) -> bool

AutomationCore

Defines an action a user wants to take when a certain number of events do or don’t happen to the matching resources Methods:

model_validate_list

model_validate_list(cls, obj: Any) -> list[Self]

prevent_run_deployment_loops

prevent_run_deployment_loops(self) -> Self
Detects potential infinite loops in automations with RunDeployment actions

reset_fields

reset_fields(self: Self) -> Self
Reset the fields of the model that are in the _reset_fields set. Returns:
  • A new instance of the model with the reset fields.

trigger_by_id

trigger_by_id(self, trigger_id: UUID) -> Optional[Trigger]
Returns the trigger with the given ID, or None if no such trigger exists

triggers

triggers(self) -> Sequence[Trigger]
Returns all triggers within this automation

triggers_of_type

triggers_of_type(self, trigger_type: Type[T]) -> Sequence[T]
Returns all triggers of the specified type within this automation

Automation

Methods:

model_validate

model_validate(cls: type[Self], obj: Any) -> Self

AutomationCreate

AutomationUpdate

AutomationPartialUpdate

AutomationSort

Defines automations sorting options. Methods:

auto

auto() -> str
Exposes enum.auto() to avoid requiring a second import to use AutoEnum

Firing

Represents one instance of a trigger firing Methods:

all_events

all_events(self) -> Sequence[ReceivedEvent]

all_firings

all_firings(self) -> Sequence[Firing]

model_validate_list

model_validate_list(cls, obj: Any) -> list[Self]

reset_fields

reset_fields(self: Self) -> Self
Reset the fields of the model that are in the _reset_fields set. Returns:
  • A new instance of the model with the reset fields.

validate_trigger_states

validate_trigger_states(cls, value: set[TriggerState]) -> set[TriggerState]

TriggeredAction

An action caused as the result of an automation Methods:

all_events

all_events(self) -> Sequence[ReceivedEvent]

all_firings

all_firings(self) -> Sequence[Firing]

idempotency_key

idempotency_key(self) -> str
Produce a human-friendly idempotency key for this action

model_validate_list

model_validate_list(cls, obj: Any) -> list[Self]

reset_fields

reset_fields(self: Self) -> Self
Reset the fields of the model that are in the _reset_fields set. Returns:
  • A new instance of the model with the reset fields.