The trigger functionality is part of Automations, which is a Cloud-only feature, that’s why you won’t find it in the Python client. You can sign up for a free tier (no time limits) here:
https://app.prefect.cloud/
I wrote this example for you to show how you can execute that cleanup task even when something fails:
The easiest way to accomplish that is to leverage the allow_failure utility.
Here is a simple flow example that demonstrates how you can use it:
from prefect import task, flow, get_run_logger, allow_failure
import random
@task
def extract_data():
return 42
@task
def extract_data_2():
return 2
@task
def transform_data(x: int, y: int = 2) -> int:
if random.random() > 0.5:
raise ValueError("Non-deterministic error has occured.")
else:
return (x + 42) * y
@t…