Processing · Chapter 11
Lakeflow Jobs: orchestrating Databricks jobs in production
Reviewed by TechFabric engineers. How we write this guide →
Lakeflow Jobs, formerly Databricks Workflows, is Databricks' built-in orchestrator. A job is a graph of tasks (notebooks, Python scripts and wheels, SQL, Lakeflow pipelines, dbt, JARs, other jobs, if/else branches and for-each loops) that runs on a schedule or when data changes: a file lands, a table is updated, a model version is ready. It handles retries, timeouts, notifications and repair of failed runs, and records every run in system.lakeflow tables you can query.
Orchestration is where a collection of working pipelines becomes a platform that runs unattended, and its design is felt every day by whoever carries the pager. This chapter is the layout and settings we'd use, current as of October 2026.
The short version
Orchestration is the part of the platform that decides what runs, when it runs, what happens when it fails, and who finds out. It is unglamorous and it is the difference between a data platform that a business can depend on and a set of scripts somebody has to remember to run. Databricks includes this as part of the product rather than as a separate service you install and operate, which matters more than it sounds: because the scheduler runs inside the same system as the data, it can start work when a file lands or when a table is updated instead of guessing with a clock, it already knows who is allowed to run what, and it records what produced which table without anybody wiring that up. A second, separately maintained scheduler running alongside all of this is a cost paid in staff time, and we'd want a reason for it.
What a job is, and what belongs in one #
A job runs as a graph of tasks with dependencies between them. The task types as of October 2026 are notebook, Python script, Python wheel, SQL, pipeline (including ingestion and database table sync pipelines), dbt, JAR, Spark Submit, Run Job, dashboard, Power BI, Clean Room notebook, if/else and for each, plus newer ones: Genie Code (an agent prompt as a task, GA since 21 October 2026), SQL Alert (Public Preview) and dbt platform (Public Preview). For the great majority of data workloads that's sufficient.
The question that matters more than any setting is which dependencies belong in the job graph at all. A dependency between two tables belongs inside a declarative pipeline, which understands table lineage and incremental processing. A dependency between two systems, or between a job and something arriving from outside, belongs in the job graph.
A job graph with forty tasks is usually a pipeline that escaped into the orchestrator. The shape we'd aim for is a job per business process, with tasks a non-specialist could name, such as ingest, transform, validate, publish, and notify. When a task cannot be named in one word, it is usually doing two things.
Trigger on data, not on hope #
Time-based schedules encode an assumption about when upstream data arrives, and that assumption decays quietly. A job scheduled for two in the morning because the source used to land at one thirty will keep running at two long after the source moved.
Where the platform supports it we'd trigger on the event rather than the clock. The trigger types are:
| Trigger | Fires when | Status |
|---|---|---|
| Scheduled | A time schedule comes round | GA |
| File arrival | New files land in a Unity Catalog volume or external location | GA |
| Table update | Watched tables change | GA |
| Model update | A Unity Catalog model version is ready or an alias is set | Beta |
| Continuous | The previous run ends, so the job is always running | GA |
Since 5 October 2026 a job can carry up to five triggers at once (Beta, switched on from the workspace Previews page), of the same or different types, each paused independently; a continuous trigger can't be combined with others. In the Jobs API that's the triggers array, which replaces the older single trigger, schedule and continuous fields rather than sitting beside them. A workspace can hold up to 12,000 active triggers across all jobs.
For downstream consumers of a table another job writes, a table update trigger watches up to ten tables and fires when any or all of them change, with a minimum gap between runs and a wait after the last change, which is what stops a burst of small upstream commits from starting ten runs. Where a clock trigger is genuinely necessary, we'd pair it with a sensor task that fails fast and loudly if the expected input is absent, rather than letting the job process yesterday's data silently.
What a table update trigger can watch, and the permission it needs #
Table update triggers reach further than Delta tables in your own metastore. Databricks' documentation lists Unity Catalog Delta and Iceberg managed tables, Unity Catalog external tables backed by Delta Lake, materialized views, streaming tables, and Unity Catalog views or metric views that depend on supported tables, plus OpenSharing tables, views, metric views, materialized views and streaming tables, and system tables (trigger jobs when source tables are updated). Triggering a job off a billing system table when new records land is the example we'd reach for first, because it replaces a polling job that exists only to notice something.
The requirement to design around is identity. The principal in the job's Run as field must hold SELECT on every object the trigger monitors, plus USE CATALOG and USE SCHEMA on the containing catalog and schema, and SELECT on a view's underlying tables rather than on the view. If it doesn't, the trigger fails to evaluate and the job simply does not run. That's a silent failure in the shape teams find a week later, so check the Run as principal's grants at the same time as you set the trigger, not after.
Two settings decide how chatty it is. Minimum time between triggers in seconds is the floor after a previous run completes; Wait after last change in seconds resets on each further update, which is the one to use when changes arrive in batches and the whole batch has to land first. Using both stacks them: with a 120 second minimum and a 60 second wait, updates at 5 and 115 seconds mean a run is not triggered until after 175 seconds. Databricks states the triggers carry no additional cost beyond the cloud provider charges for listing tables and reading updates, and recommends enabling file events on the external location holding the tables for better performance and scalability.
When a clock trigger is the right one #
A clock isn't wrong when it's the users' clock. A business-hours refresh is a deliberate statement about when staleness matters, which is different from a 2am schedule that guesses when upstream lands. Andrey Taran's embedded-analytics project ended on exactly that kind of schedule, set by when the client's users were looking; the account is in Real-time and CDC and his write-up. We'd write the reason and each cadence into the job description, so the next engineer can tell a deliberate quiet night from a broken trigger, and keep a freshness check on the output table so a skipped daytime run still pages someone.
The settings that decide whether on-call is bearable #
Retries should have a backoff and a low count, because a job that retries five times with no delay against a source that is down simply fails five times faster. Two or three attempts with a meaningful gap catches the transient case, which is the only case retries help with.
Timeouts belong on every task. The default of running until something gives up means a hung task blocks its dependents indefinitely and burns compute while doing it, and any task without a timeout will eventually meet the pathological input that hangs it.
Concurrency should be capped and the overlap behaviour chosen deliberately. A job that takes longer than its schedule interval will, by default, start overlapping with itself, and two concurrent writers to the same table is a class of bug that is very hard to diagnose after the fact.
Here is how those settings look in a bundle, for a job that waits on two silver tables and publishes a gold one:
resources:
jobs:
publish_margin:
name: publish-margin
trigger:
table_update:
table_names:
- main.silver.orders
- main.silver.shipments
condition: ALL_UPDATED
min_time_between_triggers_seconds: 900
wait_after_last_change_seconds: 300
max_concurrent_runs: 1
queue:
enabled: true
health:
rules:
- metric: RUN_DURATION_SECONDS
op: GREATER_THAN
value: 3600
email_notifications:
on_failure: [data-oncall@example.com]
on_duration_warning_threshold_exceeded: [data-oncall@example.com]
tasks:
- task_key: publish
timeout_seconds: 1800
max_retries: 2
min_retry_interval_millis: 300000
pipeline_task:
pipeline_id: ${resources.pipelines.gold_margin.id}Every number there is a decision we'd want written down: a run must wait five minutes after the last upstream commit, can't start more than once every fifteen, gives up after half an hour, retries twice with five minutes between attempts, and warns the on-call engineer when the whole run passes an hour.
The arithmetic is worth doing once, because these settings multiply. Two retries with a five-minute gap on a task with a thirty-minute timeout means the worst case for that one task is three attempts of thirty minutes plus two waits of five, which is an hour and forty minutes before the job reports failure. If the stakeholder needs the table by seven and upstream lands at five, that worst case already misses the deadline, and we'd rather lower the timeout to what a healthy run takes plus a margin (a task that normally finishes in eight minutes gets fifteen, not thirty) than discover the sum at a quarter past seven. The duration warning on the job is the early signal for the same problem: set it to roughly twice a normal run, so it fires on the slow night rather than on every slightly busy one.
Compute, parameters, and environments #
Job compute, created for a run and terminated after it, is the default for scheduled work. It costs less than all-purpose compute, it starts from a clean state, and it cannot be left running by accident. Serverless compute for jobs removes the start-up latency and the capacity planning, and we'd reach for it first for short and bursty tasks where cluster start-up was a meaningful share of the runtime. For long-running, heavily tuned workloads with specific instance requirements, a configured job cluster still wins. Shared all-purpose clusters are for interactive development and should not appear in a production job definition at all.
A job definition that mentions originations_prd cannot be tested. Parameterise the catalog, the source paths and anything else environment-specific, supply the values from a Declarative Automation Bundle (formerly Asset Bundles; the CLI is still databricks bundle) as described in CI/CD and environments, and treat a literal environment name inside a notebook as a review failure.
The layout we'd give a new estate #
Most of what goes wrong in a jobs estate is layout rather than configuration, so this is the set of rules we'd write into a team's README before the first production job.
- One job per business process, owned by one team. "Close the books", "refresh the sales mart", "retrain the churn model". The owning team's group is the job's owner and the only group with manage permission; everyone else gets view.
- Runs as a service principal, never a person. A job that runs as the engineer who created it breaks the week that engineer leaves, and its audit trail names the wrong actor for every write.
- Pipelines inside, systems between. Table-to-table dependencies stay in a pipeline; the job holds the edges to the outside world: the file, the upstream job, the export, the notification.
- Every job has a freshness check on its last output table. It runs as the final task with run-if set to all done, so it reports even when the run failed, and it's the alert that pages someone.
- Nothing is scheduled by clock without a reason in the description. If the reason is "the source lands at 1:30", the job gets a file arrival or table update trigger instead.
The test we'd apply after a month is simple: could a new engineer, reading only the job names and their owners, say who to call when a given dashboard is stale? If not, the layout has drifted into a single shared graph, and the repair is splitting jobs along ownership lines and connecting them with run job tasks.
Auditing an estate you inherited #
Before changing anything in an existing jobs estate, measure it: the jobs system tables already hold the answers, and a review built on them takes an afternoon rather than a week of interviews. Three things make the queries easier to get right. system.lakeflow.jobs is a slowly changing table, one row per change, so the current definition of a job is the latest row per job and a deletion is a new row with delete_time set; pick the latest row first and filter deletions after, or a deleted job shows up as its last live state. And system.lakeflow.job_run_timeline records up to an hour per row, so a run longer than an hour spans several rows and its result arrives only on the last one. And run_as_user_name, creator_user_name and timeout_seconds are empty on rows written before early December 2025; since 19 October 2026 saving a job without changing it no longer writes a new row, so a job nobody has edited since then still shows the old, empty values.
The first query lists the jobs that break two of the layout rules above, running as a person and having no job-level timeout:
WITH latest AS (
SELECT *,
ROW_NUMBER() OVER (PARTITION BY workspace_id, job_id ORDER BY change_time DESC) AS rn
FROM system.lakeflow.jobs
)
SELECT workspace_id, job_id, name, run_as_user_name, creator_user_name, timeout_seconds
FROM latest
WHERE rn = 1
AND delete_time IS NULL
AND (run_as_user_name LIKE '%@%' OR run_as_user_name IS NULL
OR timeout_seconds IS NULL OR timeout_seconds = 0)
ORDER BY name;A run_as_user_name containing an @ is a person rather than a service principal, which is the job that breaks when that person leaves. A NULL one is a job untouched since before the column existed; open it and check by hand. The second query finds jobs whose runs regularly fail or run long, summing the hourly slices into one row per run first. It measures time from the slice timestamps, because the *_duration_seconds columns are filled only for single-task jobs created through the legacy Jobs API and read 0 for every multi-task run:
WITH runs AS (
SELECT workspace_id, job_id, run_id,
MIN(period_start_time) AS started,
MAX(period_end_time) AS ended,
MAX_BY(result_state, period_end_time) AS result_state
FROM system.lakeflow.job_run_timeline
WHERE period_start_time >= current_date() - INTERVAL 30 DAYS
GROUP BY ALL
)
SELECT workspace_id, job_id,
COUNT(*) AS runs,
COUNT_IF(result_state <> 'SUCCEEDED') AS not_succeeded,
ROUND(AVG(timestampdiff(SECOND, started, ended)) / 60, 1) AS avg_minutes,
ROUND(MAX(timestampdiff(SECOND, started, ended)) / 60, 1) AS max_minutes
FROM runs
GROUP BY ALL
HAVING not_succeeded > 0 OR max_minutes > 2 * avg_minutes
ORDER BY not_succeeded DESC, max_minutes DESC;What we'd do with the output: a job whose longest run is more than twice its average is usually waiting on something (another run of itself, a concurrency cap set too low, or a cluster that's slow to start), and the task timeline shows which task took the time, and a job with a steady trickle of failures that nobody has asked about is the one whose alerts already go to a mailbox nobody reads. Fix ownership and timeouts first, because they are a configuration change; splitting and re-triggering jobs comes after, once the list is short.
Pipelines have their own pair of tables, GA since 21 October 2026: system.lakeflow.pipelines (one row per change, like the jobs table) and system.lakeflow.pipeline_update_timeline. The pipelines whose updates fail, which a job's pipeline task reports only as a failed task, come out of the second:
WITH updates AS (
SELECT workspace_id, pipeline_id, update_id,
MAX_BY(result_state, period_end_time) AS result_state,
ANY_VALUE(update_type) AS update_type
FROM system.lakeflow.pipeline_update_timeline
WHERE period_start_time >= current_date() - INTERVAL 30 DAYS
GROUP BY ALL
)
SELECT workspace_id, pipeline_id,
COUNT(*) AS updates,
COUNT_IF(result_state = 'FAILED') AS failed,
COUNT_IF(update_type = 'FULL_REFRESH') AS full_refreshes
FROM updates
GROUP BY ALL
HAVING failed > 0 OR full_refreshes > 0
ORDER BY failed DESC;Long updates are sliced by the hour like job runs, hence the first step.
A pipeline that full-refreshes more than rarely is worth a question too: it's either recovering from lost change logs or rebuilding something that should be incremental.
Beyond the basics #
Each feature below removes a piece of machinery people otherwise build by hand, and they're the ones we'd check for first when reviewing a jobs estate.
Repair runs. When a run fails part way through a graph, repairing it re-executes only the failed task and its dependents, reusing the successful output of everything upstream. We'd call it the most useful feature in the scheduler, because the alternative is re-running a two-hour graph to retry the ten-second task at the end of it.
Task values. A task can publish small values that later tasks read, so a graph can pass a computed watermark, a row count, or a decision downstream without a side table or a file in cloud storage acting as a message queue.
Conditional tasks and run-if rules. An if/else task compares two values (often a task value from an earlier task) and each dependent task follows the true or false outcome. Separately, every task has a run-if rule: all succeeded (the default), at least one succeeded, none failed, all done, at least one failed, or all failed. Together they express the two patterns everybody needs, skipping expensive work when there's nothing new and always running the notification even when the run failed:
tasks:
- task_key: count_new
notebook_task:
notebook_path: ../src/count_new_rows.py # calls dbutils.jobs.taskValues.set("row_count", n)
- task_key: has_new_rows
depends_on: [{ task_key: count_new }]
condition_task:
op: GREATER_THAN
left: "{{tasks.count_new.values.row_count}}"
right: "0"
- task_key: transform
depends_on: [{ task_key: has_new_rows, outcome: "true" }]
pipeline_task:
pipeline_id: ${resources.pipelines.silver_orders.id}
- task_key: freshness_check
# count_new always runs, so this check runs even when transform is skipped for want of new rows
depends_on: [{ task_key: count_new }, { task_key: transform }]
run_if: ALL_DONE
sql_task:
warehouse_id: ${var.warehouse_id}
file:
path: ../src/freshness_check.sqlFor-each tasks. A for each task fans out over a JSON array, running one nested task per element with {{input}} (or {{input.<key>}} for objects) as the parameter. Concurrency defaults to 1, so set it. Ingesting forty tables from one source becomes one task rather than forty near-identical ones that drift apart:
- task_key: ingest_tables
for_each_task:
inputs: '["orders", "customers", "invoices", "shipments"]'
concurrency: 4
task:
task_key: ingest_one
notebook_task:
notebook_path: ../src/ingest_table.py
base_parameters:
table: "{{input}}"Inputs written into the job definition are capped at 5,000 characters, and a task-value reference can resolve to up to 48 KB, so a long list comes from an earlier task rather than the job definition. A for-each can't contain another for-each.
Job composition. A run job task lets one job call another as a unit, so a team can own a job with its own schedule and permissions and still have it invoked as a step inside a wider process. It's how we'd keep domain ownership intact without one enormous shared graph.
Health rules and duration alerts. A job can alert when a run exceeds an expected duration rather than only when it fails, which catches the degradation that precedes an outage. A nightly job that has crept from twenty minutes to ninety is worth hearing about before the morning it does not finish.
Git-sourced jobs and queueing. A job can run code directly from a commit in a repository rather than from files in the workspace, which removes the class of incident where someone edited a notebook in production and nobody can say what changed. Separately, with queue.enabled, a triggered run that arrives while the previous one is still going is queued instead of skipped, which turns a race condition into an ordered backlog. Without it, runs past max_concurrent_runs are skipped.
Running a scheduled data platform on each cloud
| Capability | Databricks | AWS | Azure | GCP |
|---|---|---|---|---|
| The orchestrator itself | Lakeflow Jobs, part of the platform | Step Functions, or MWAA for Airflow | Data Factory or Synapse pipelines | Cloud Composer, managed Airflow |
| Something to operate | Nothing; it is a managed feature | MWAA environments are sized, patched, upgraded | Managed | Composer environments are sized and upgraded |
| Cost while idle | Serverless jobs bill per run | An MWAA environment runs continuously | Per activity run | A Composer environment runs continuously |
| Trigger on file arrival | Built in | S3 events into EventBridge into Step Functions | Event Grid trigger in Data Factory | Storage notification into a Composer sensor |
| Trigger on a table being updated | Built in, including system and shared tables | Build it yourself | Build it yourself | Build it yourself |
| Re-run only the failed part | Repair run, one click | Step Functions redrive, or clearing tasks in Airflow | Rerun from failed activity | Clearing tasks in Airflow |
| Lineage from job to table | Automatic in Unity Catalog | Separate, via Glue or DataZone | Separate, via Purview | Separate, via Dataplex |
| Permissions model | The same catalog identities as the data | IAM roles per service | Separate | Separate |
The row we'd draw attention to is the lineage one. Every other product on that table schedules work perfectly well; none of them can tell you, without additional tooling, which run produced the column a regulator is asking about.
What's popular