New to Kestra?
Use blueprints to kickstart your first workflows.
Profile a month of NYC taxi data in DuckDB and stop the load with Kestra SLA assertions before a bad month is published.
A monthly load guarded by flow-level sla: rules instead of If and Fail tasks: a month of NYC TLC green
taxi trips (about 1 MB) is profiled in DuckDB, and a bad month fails the run before anything is published.
monthly runs on the 25th for the month two months back; a manual run takes month or that default.fetch (Parallel) reads the previous month's trip count from the KV store and downloads the month.profile (DuckDB) computes the numbers the rules read: trips, change from the previous month, share of
trips without a passenger count, share picked up outside the month.sla rules are checked every time the execution changes. As soon as profile ends, a false rule fails
the run and labels it sla_breach: <rule>: curate, publish and remember never start.curate writes the cleaned month to Parquet, publish uploads it to the namespace files and
remember keeps its numbers as the next baseline. load_duration caps the run at 15 minutes.Rules are evaluated before profile has run, so each one reads its output through ??:
# Wrong: fails every run at the first task ("could not be evaluated and is treated as violated")
assert: "{{ outputs.profile.row.trips >= inputs.min_trips }}"
# Right: passes until profile has run, then checks the real value
assert: "{{ (outputs.profile.row.trips ?? inputs.min_trips) >= inputs.min_trips }}"
Don't add afterExecution tasks to this flow: on Kestra 2.0.6, a flow that has them still starts the next task
after an SLA failure, so a bad month would be published
(kestra-io/kestra#22036).
nyc_taxi/green/, only for months that pass every rule.Data engineers and analytics engineers who load third-party files on a schedule.
Declared once for the flow, a rule also guards tasks added later, needs no extra task in the Gantt, and labels
the execution so failures can be filtered or alerted on. Switch a rule's behavior to NONE to try a new
threshold without stopping loads.
Kestra 2.0 with the DuckDB plugin. The TLC files are public.
None.
month 2020-03, then 2020-04: April 2020 (35,644 trips, down 84%) fails on stable_volume.monthly trigger.Flow trigger on FAILED executions where labels.sla_breach is defined.