Back to Prefect

automations

docs/v3/api-ref/python/prefect-server-events-schemas-automations.mdx

3.6.30.dev322.9 KB
Original Source

prefect.server.events.schemas.automations

Classes

Posture <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L55" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Methods:

auto <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/collections.py#L70" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
auto() -> str

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

TriggerState <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L61" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Methods:

auto <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/collections.py#L70" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
auto() -> str

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

Trigger <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L66" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

Methods:

all_triggers <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L109" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
all_triggers(self) -> Sequence[Trigger]

Returns all triggers within this trigger

automation <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L80" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
automation(self) -> 'Automation'

create_automation_state_change_event <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L114" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

model_validate_list <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

parent <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L87" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

reset_fields <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
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 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L103" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
reset_ids(self) -> None

Resets the ID of this trigger and all of its children

CompositeTrigger <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L119" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

Methods:

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

python
actions(self) -> List[ActionTypes]

all_triggers <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L168" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
all_triggers(self) -> Sequence[Trigger]

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

python
as_automation(self) -> 'AutomationCore'

child_trigger_ids <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L172" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
child_trigger_ids(self) -> List[UUID]

create_automation_state_change_event <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L128" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
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 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/events/schemas/automations.py#L55" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
describe_for_cli(self, indent: int = 0) -> str

Return a human-readable description of this trigger for the CLI

num_expected_firings <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L176" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
num_expected_firings(self) -> int

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

python
owner_resource(self) -> Optional[str]

ready_to_fire <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L180" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

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

python
set_deployment_id(self, deployment_id: UUID) -> None

CompoundTrigger <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L183" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

Methods:

num_expected_firings <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L191" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
num_expected_firings(self) -> int

ready_to_fire <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L199" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

validate_require <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L203" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
validate_require(self) -> Self

SequenceTrigger <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L215" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L222" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
expected_firing_order(self) -> List[UUID]

ready_to_fire <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L225" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

ResourceTrigger <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L232" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

Methods:

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

python
actions(self) -> List[ActionTypes]

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

python
as_automation(self) -> 'AutomationCore'

coerce_match <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L254" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
coerce_match(cls, v: Any) -> Any

coerce_match_related <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L261" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
coerce_match_related(cls, v: Any) -> Any

covers_resources <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L273" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

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

python
describe_for_cli(self, indent: int = 0) -> str

Return a human-readable description of this trigger for the CLI

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

python
owner_resource(self) -> Optional[str]

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

python
set_deployment_id(self, deployment_id: UUID) -> None

EventTrigger <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L289" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

Methods:

bucketing_key <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L438" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

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

python
coerce_match(cls, v: Any) -> Any

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

python
coerce_match_related(cls, v: Any) -> Any

covers <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L380" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
covers(self, event: ReceivedEvent) -> bool

create_automation_state_change_event <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L452" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
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 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L354" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

event_pattern <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L397" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
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 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L429" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
expects(self, event: str) -> bool

immediate <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L390" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
immediate(self) -> bool

Does this reactive trigger fire immediately for all events?

meets_threshold <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L443" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
meets_threshold(self, event_count: int) -> bool

starts_after <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L417" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
starts_after(self, event: str) -> bool

AutomationCore <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L504" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

prevent_run_deployment_loops <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L560" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
prevent_run_deployment_loops(self) -> Self

Detects potential infinite loops in automations with RunDeployment actions

reset_fields <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
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 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L552" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
trigger_by_id(self, trigger_id: UUID) -> Optional[Trigger]

Returns the trigger with the given ID, or None if no such trigger exists

triggers <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L544" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
triggers(self) -> Sequence[Trigger]

Returns all triggers within this automation

triggers_of_type <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L548" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
triggers_of_type(self, trigger_type: Type[T]) -> Sequence[T]

Returns all triggers of the specified type within this automation

Automation <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L633" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Methods:

model_validate <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L639" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

AutomationCreate <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L654" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

AutomationUpdate <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L660" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

AutomationPartialUpdate <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L664" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

AutomationSort <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L668" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Defines automations sorting options.

Methods:

auto <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/utilities/collections.py#L70" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
auto() -> str

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

Firing <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L677" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Represents one instance of a trigger firing

Methods:

all_events <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L742" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
all_events(self) -> Sequence[ReceivedEvent]

all_firings <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L737" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
all_firings(self) -> Sequence[Firing]

model_validate_list <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

reset_fields <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
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 <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L732" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

TriggeredAction <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L749" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

An action caused as the result of an automation

Methods:

all_events <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L813" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
all_events(self) -> Sequence[ReceivedEvent]

all_firings <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L810" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
all_firings(self) -> Sequence[Firing]

idempotency_key <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/automations.py#L800" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
idempotency_key(self) -> str

Produce a human-friendly idempotency key for this action

model_validate_list <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

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

reset_fields <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
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.