docs/v3/api-ref/python/prefect-automations.mdx
prefect.automationsAutomation <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L78" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Methods:
acreate <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L81" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>acreate(self: Self) -> Self
Asynchronously create a new automation.
Examples:
auto_to_create = Automation(
name="woodchonk",
trigger=EventTrigger(
expect={"animal.walked"},
match={
"genus": "Marmota",
"species": "monax",
},
posture="Reactive",
threshold=3,
within=timedelta(seconds=10),
),
actions=[CancelFlowRun()]
)
created_automation = await auto_to_create.acreate()
adelete <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L273" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>adelete(self: Self) -> bool
Asynchronously delete an automation.
Examples:
auto = Automation.read(id = 123)
await auto.adelete()
adisable <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L320" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>adisable(self: Self) -> bool
Asynchronously disable an automation.
Raises:
ValueError: If the automation does not have an idPrefectHTTPStatusError: If the automation cannot be disabledExample:
auto = await Automation.aread(id = 123)
await auto.adisable()
aenable <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L374" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>aenable(self: Self) -> bool
Asynchronously enable an automation.
Raises:
ValueError: If the automation does not have an idPrefectHTTPStatusError: If the automation cannot be enabledExample:
auto = await Automation.aread(id = 123)
await auto.aenable()
aread <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L182" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>aread(cls, id: UUID, name: Optional[str] = ...) -> Self
aread <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L186" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>aread(cls, id: None = None, name: str = ...) -> Self
aread <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L189" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>aread(cls, id: Optional[UUID] = None, name: Optional[str] = None) -> Self
Asynchronously read an automation by ID or name.
Examples:
automation = await Automation.aread(name="woodchonk")
automation = await Automation.aread(id=UUID("b3514963-02b1-47a5-93d1-6eeb131041cb"))
aupdate <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L140" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>aupdate(self: Self) -> None
Updates an existing automation.
Examples:
auto = Automation.read(id=123)
auto.name = "new name"
auto.update()
create <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L111" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>create(self: Self) -> Self
Create a new automation.
Examples:
auto_to_create = Automation(
name="woodchonk",
trigger=EventTrigger(
expect={"animal.walked"},
match={
"genus": "Marmota",
"species": "monax",
},
posture="Reactive",
threshold=3,
within=timedelta(seconds=10),
),
actions=[CancelFlowRun()]
)
created_automation = auto_to_create.create()
delete <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L297" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>delete(self: Self) -> bool
Delete an automation.
Examples:
auto = Automation.read(id = 123)
auto.delete()
disable <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L347" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>disable(self: Self) -> bool
Disable an automation.
Raises:
ValueError: If the automation does not have an idPrefectHTTPStatusError: If the automation cannot be disabledExample:
auto = Automation.read(id = 123)
auto.disable()
enable <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L401" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>enable(self: Self) -> bool
Enable an automation.
Raises:
ValueError: If the automation does not have an idPrefectHTTPStatusError: If the automation cannot be enabledExample:
auto = Automation.read(id = 123)
auto.enable()
read <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L228" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>read(cls, id: UUID, name: Optional[str] = ...) -> Self
read <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L232" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>read(cls, id: None = None, name: str = ...) -> Self
read <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L236" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>read(cls, id: Optional[UUID] = None, name: Optional[str] = None) -> Self
Read an automation by ID or name.
Examples:
automation = Automation.read(name="woodchonk")
automation = Automation.read(id=UUID("b3514963-02b1-47a5-93d1-6eeb131041cb"))
update <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/automations.py#L160" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>update(self: Self)
Updates an existing automation.
Examples:
auto = Automation.read(id=123)
auto.name = "new name"
auto.update()