Let’s Get Certified
Module 18 / 21 · Pipelines and orchestration

Lakeflow Jobs and monitoring

Build a task graph, choose a trigger, and trace retries, repair runs, and alerts through a scheduled workflow.

Jobs, tasks, and the DAG

A job contains one or more tasks. Each task has a task key, a type, compute, and optional dependencies (depends_on) on other tasks. Together they form a DAG (directed acyclic graph) shown in the Tasks tab. Tasks without dependencies between them run in parallel.

Task types

Add Task picker in a Lakeflow job
In the UI. The Add Task picker lists the task types: notebook, Python script, SQL query, SQL file, SQL alert and more further down.
Task configuration form of a job
In the UI. A task being configured: Task name, Type, Source (Workspace or a Git provider), Path, Compute (Serverless here), environment and libraries, and parameters. The canvas above draws the DAG.
Task typeRuns
NotebookA notebook from the workspace or a Git provider, with parameters
Python script, Python wheel, JAR, Spark SubmitCode packages
SQLA SQL query, SQL file, alert, or legacy dashboard on a SQL warehouse
PipelineAn update of a Lakeflow Declarative Pipeline (optionally full refresh)
DashboardRefresh an AI/BI dashboard and optionally send it to subscribers
dbtdbt commands
Run JobTrigger another job (modular orchestration)
If/else conditionBranching on a boolean expression
For eachLooping: runs a nested task once per item of a list

Compute per task: serverless jobs compute, a shared job cluster (reused by several tasks in the same run), or an existing all-purpose cluster (not recommended for production). SQL tasks use a SQL warehouse.

Control flow New exam

Run if dependencies

Each task has a Run if condition evaluated on its upstream tasks:

Run ifTask runs when
All succeeded (default)Every dependency succeeded
At least one succeededOne or more dependencies succeeded
None failedNo dependency failed (succeeded or skipped/excluded)
All doneAll dependencies finished, whatever the result (use for cleanup)
At least one failedOne or more dependencies failed (use for alerting or fallback)
All failedEvery dependency failed

Branching with If/else

An If/else condition task compares two operands with ==, !=, >, >=, <, <=. Operands can be literals, job parameters, or task values from an upstream task. Downstream tasks depend on the true or false outcome.

# In upstream task "validate":
dbutils.jobs.taskValues.set(key="row_count", value=df.count())
# If/else condition: {{tasks.validate.values.row_count}} > 0
# In a downstream task:
n = dbutils.jobs.taskValues.get(taskKey="validate", key="row_count", default=0)

Looping with For each

A For each task iterates over a JSON array (literal, job parameter, or task value) and runs one nested task per item, with configurable concurrency. Each iteration gets the item as {{input}}. Example: ingest the same way for a list of 20 countries.

Retries, timeouts and thresholds

Notifications, retries and metric thresholds of a task
In the UI. The bottom of the task form: Parameters, Notifications, Retries (this serverless task retries immediately, at most 3 times) and Metric thresholds.
  • Retries: per task, number of retries, minimum interval between attempts, and whether to retry on timeout. Use for transient failures (network, Auto Loader schema evolution restarts).
  • Retry defaults: retries default to none. For most job configurations the default is no retry on task failure; you set the number of attempts and the wait between them. Serverless jobs automatically optimize retries by default.
  • Retry interval: set in milliseconds, measured from the start of the failed run to the start of the retry.
  • Timeout: maximum task duration. When exceeded the run is stopped with status Timed Out. If healthy runs routinely exceed a configured timeout, check the job history to distinguish slower processing from an unrealistic limit. Warning thresholds notify operators and task timeouts stop the task.
  • Timeout with retries: if a task has both a timeout and retries, the timeout applies to each attempt.
  • Duration warning threshold: sends a notification when a task runs longer than expected, without stopping it.
  • Streaming backlog thresholds for streaming tasks.

Parameters

Job parameters are key/value pairs applied to all tasks (override per run with "Run now with different parameters"). Dynamic value references inject run context: {{job.id}}, {{job.run_id}}, {{job.start_time.iso_date}}, {{tasks.<key>.values.<name>}}, {{job.trigger.type}}. Notebook tasks read them with dbutils.widgets.get.

Triggers and schedules New exam

Trigger types of a Lakeflow job
In the UI. Schedules & Triggers, opened with Add trigger in the job side panel. Trigger types: None (manual), Scheduled, File arrival, Table update, Continuous, Model update and Upstream job completion.
TriggerStarts a runGood for
ScheduledOn a time schedule (simple interval or Quartz cron syntax with time zone)Data that arrives at known times; daily reports
File arrivalWhen new files land in a Unity Catalog external location or volume path. Checks about every minute; optional minimum time between triggers and wait-after-last-change.Unpredictable file drops; no idle compute, no empty runs
Table updateWhen one or more Unity Catalog tables are updated (any or all of them)Run downstream processing when upstream data changes, across teams or pipelines
ContinuousAlways keeps one run active; a new run starts when the previous endsStreaming jobs that must always run
Manual / API"Run now", databricks jobs run-now, REST API, Run Job taskAd hoc, external orchestrators (e.g. Airflow)

A trigger can be active or paused. In a workspace with the Multiple Triggers beta enabled, a job can have up to five triggers. Any active trigger can start a run. A continuous schedule runs alone.

Time-based vs data-driven

Choose time-based (scheduled) when data availability is predictable or the business needs output at a fixed time. Choose data-driven (file arrival, table update) when data arrives irregularly or a job depends on another team's table: it saves compute and reduces latency.

The schedule editor and Quartz cron

  • The schedule editor has Simple and Advanced (cron) modes, uses 24-hour time, and defaults to UTC: set the time zone explicitly.
  • The notebook Schedule button is a shortcut that creates a single-task job.

Cron in Databricks is Quartz cron. Quartz cron has a seconds field first: seconds minutes hours day-of-month month day-of-week, and one of day-of-month or day-of-week must be ?. Every day at 2:30 a.m.: 0 30 2 * * ? (Unix cron would be 30 2 * * *). Always set the time zone.

Other job settings

Other job settings: maximum concurrent runs (default 1; extra triggers are skipped or queued when queueing is enabled), notifications on start, success, failure, duration warning (email, Slack, Teams, webhooks), Run as (user or service principal), tags, permissions (Can View, Can Manage Run, Is Owner, Can Manage).

Email notifications work out of the box. Slack, Microsoft Teams, PagerDuty and webhooks need a notification destination created first by a workspace admin (Settings, Notifications, Manage destinations).

Monitoring jobs

  • Runs tab: list of runs with status, start time, duration, trigger. The matrix view shows each task's status and duration across recent runs, so you can spot a task getting slower or failing often.
  • Run details: the DAG with each task colored by status; click a task for output, logs, Spark UI, and error message. An upstream failure shows downstream tasks as Upstream failed (or Skipped).
  • Statuses: Pending, Queued, Running, Succeeded, Failed, Timed Out, Canceled, Skipped, Upstream failed, Excluded, Succeeded with failures.
  • Repair run: rerun only the failed and skipped tasks (and their dependents) of a failed run, keeping successful task results. Saves time and cost.
  • Jobs monitoring page and the system.lakeflow system tables (jobs, job_run_timeline, job_task_run_timeline) give history for trend analysis: compare current run duration against the historical baseline.

Diagnosing failures

In a failed task run or notebook cell, Diagnose error asks Databricks Assistant to explain the error and suggest a fix. Then fix the code and use Repair run.

Visualization: AI/BI dashboards, alerts, Genie

  • AI/BI dashboards (formerly Lakeview): datasets from SQL queries, visual widgets, filters and parameters, scheduled refresh and email subscriptions, publish with embedded or viewer credentials. Can be refreshed by a Dashboard task in a job.
  • Dashboard schedule: Schedule, Add schedule: frequency (for example every 4 hours), start time, time zone, the SQL warehouse that runs the refresh, filter behavior (default or saved filters), and optional subscribers who receive an email snapshot.
  • Notebook visualizations: charts from display() output.
  • SQL editor visualizations: in the SQL editor, under the results, add a Visualization (bar, line, pie, scatter, map, counter...) and customize axes, colors and series; add it to a dashboard.
  • SQL alerts: run a query on a schedule and notify when a condition is met (e.g. error count > 0). Can be a SQL task in a job. An alert is made of a query, a trigger condition on a value (for example error_count > 0), a schedule, and destinations (email, Slack, webhooks). You can also notify when the condition returns to normal.
  • Genie spaces: natural-language questions over curated tables for business users.

Trace a dependency

A job runs ingest, then validate, then publish. Ingest succeeds and validate fails. What should happen to publish with its default dependency condition?

Check your reasoning

Publish is skipped because its upstream dependency failed. After fixing the validation problem, repair the run so failed and affected downstream tasks can finish.

Product reference

Lakeflow Jobs in the Databricks documentation

Knowledge check

Lakeflow Jobs and monitoring quiz

Answer 9 questions. Check each answer for an explanation.