CertSafari
    Databricks Certified Data Engineer Professional· Lessons

    Domain 4 · Lesson 23/46

    Monitor Jobs and Pipelines with the Databricks CLI, REST API and SDK

    Use Databricks REST APIs / CLI and SDK for monitoring and analyzing jobs and pipelines.

    15 min read
    2% of exam
    8 sources
    Published 2 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Choose between the Databricks CLI, the SDKs and the REST API for a monitoring task, and explain how they relate
    • Use databricks jobs list-runs, get-run and get-run-output to find and inspect job runs, and know their pagination and retention limits
    • Page through LIST API results correctly and handle HTTP 429 rate-limit responses
    • Retrieve pipeline updates and events with the pipelines command group, filtering by update, level and event type
    • Authenticate the Databricks SDK for Python from a local machine or a notebook

    Key concept

    The CLI and SDKs wrap the REST API — Every monitoring action, whether a CLI command, an SDK call or a curl request, ends up as the same REST request against a workspace endpoint. Pick the tool that suits the job. Each wrapper maps to a REST operation, so what you learn about one transfers to the others.

    1.One API, three ways in

    In the Lakeflow Jobs UI you can browse the run history of each job and open the details of any single run. That stops working once you need to check hundreds of runs, feed results into a script, or ask the same question every morning. For that, the Monitor Lakeflow Jobs page points you to the Databricks CLI and the Jobs API. All the programmatic options sit on one layer: the Databricks REST API. The CLI wraps it, and so do the SDKs for Python, Java, Go and R. Most CLI commands map straight to a REST request. For example, databricks jobs get maps to GET /api/2.2/jobs/get.

    When to use each programmatic tool for jobs
    ToolWhat it isTypical use
    Databricks CLICommand-line interface that wraps the REST APIOne-off tasks, experimentation, shell scripting, invoking the REST API directly
    Databricks SDKsLibraries for Python, Java, Go or RApplications and custom Databricks workflows, without hand-built curl or Postman calls
    Databricks REST APIThe underlying HTTP endpointsAutomation where no SDK exists in your preferred language

    Make sure you are on the current CLI. Versions 0.205 and above are the current Databricks CLI (1.0.0 and above is generally available). Versions 0.18 and below are the legacy CLI, and Databricks plans no support or new feature work for it. To see the options for any jobs command, add -h, for example databricks jobs <command-name> -h.

    Checkpoint 1 of 9· Check yourself

    An engineer needs a quick shell script that prints the details of one job. They want to run it from a laptop today and won't keep maintaining it. Which tool fits the documented guidance best?

    Sources123

    2.Finding and inspecting job runs

    Monitoring a job means asking questions about its runs. databricks jobs list-runs answers "which runs happened?" and returns them newest first, in descending order of start time. Its flags narrow the list down, so you aren't sorting through everything by hand.

    Key flags of databricks jobs list-runs
    FlagEffect
    --job-id intOnly runs of this job
    --active-onlyOnly active runs (otherwise active and completed)
    --completed-onlyOnly completed runs (otherwise active and completed)
    --run-type RunTypeJOB_RUN, SUBMIT_RUN or WORKFLOW_RUN
    --start-time-from / --start-time-to intRuns that started at/after or at/before this value
    --expand-tasksInclude task and cluster details
    --limit / --offset / --page-tokenPage size, offset from the most recent run, next or previous page

    Once you have a run ID, get-run returns that run's metadata. Two optional flags add more: --include-history adds the repair history, and --include-resolved-values adds the resolved parameter values. Large runs come back in pages. Arrays such as tasks, job_clusters, job_parameters and repair_history return only their first 100 elements. Pass the response's next_page_token as --page-token to fetch the rest.

    Syntax for retrieving one run's metadatabash
    databricks jobs get-run RUN_ID [flags]

    Metadata tells you how a run went. It doesn't tell you what the run produced. For that, get-run-output retrieves the output and metadata of a single task run, including any value a notebook returned through dbutils.notebook.exit(). It has two limits worth memorising. The API returns only the first 5 MB of output, so store larger results in cloud storage. And runs are automatically removed after 60 days, so save any run results you need to keep before then.

    Checkpoint 2 of 9· Check yourself

    An auditor asks for the value a notebook task returned through dbutils.notebook.exit() in a run from about three months ago. What happens when you call databricks jobs get-run-output for that run?

    Monitoring often leads straight to action, and the same command group handles that too. repair-run re-runs one or more tasks as part of the original job run, using the current job and task settings. The run must not be in progress. --rerun-all-failed-tasks repairs every failed task, and --rerun-dependent-tasks also re-runs downstream tasks that had succeeded. cancel-run is asynchronous: the run may still be running when the request completes. Its counterpart for a whole job is cancel-all-runs.

    Checkpoint 3 of 9· Exam question

    A team builds a nightly Python script against the Jobs REST API to collect every `FAILED` run of `job_id=4821` from the past 24 hours. The job triggers every 15 minutes, so the result set is expected to span several response pages. Which approach retrieves the complete set of failed runs without missing or duplicating any of them?

    Sources45

    3.Calling the REST API directly: paging and rate limits

    When you skip the wrappers, every request needs the same parts: the workspace URL (account APIs use the account console URL and account ID instead), the operation type such as GET or POST, the operation path, authentication such as a Databricks OAuth token, and any payload or query parameters. Jobs and clusters are workspace resources, so you call them with your workspace URL as the host.

    A minimal authenticated REST call to a LIST endpointbash
    curl -X GET "$DATABRICKS_HOST/api/2.0/clusters/list" \
      -H "Authorization: Bearer $DATABRICKS_TOKEN"

    A monitoring script that reads only the first page of results will quietly miss runs. LIST APIs return pages, not one large response, and the documented loop is the same for every LIST endpoint. Only the endpoint and the name of the array field in the response change.

    The documented pagination loop (shown for Unity Catalog tables; the same loop works for any LIST API)python
        tables = []
        while True:
            response = requests.get(endpoint, headers=headers, params=params)
            response.raise_for_status()
            body = response.json()
    
            tables.extend(body.get("tables", []))
    
            # Stop when the response no longer includes a page token.
            page_token = body.get("next_page_token")
            if not page_token:
                break
            params["page_token"] = page_token

    Checkpoint 4 of 9· Put it in order

    Put the documented steps for paging through a complete LIST result in order

    1. 1.Read next_page_token from the response
    2. 2.Stop when a response omits next_page_token or returns it empty
    3. 3.Send the next request with that value in the page_token query parameter
    4. 4.Send the first request with max_results=0 and no page_token

    Polling job status in a tight loop can hit rate limits, which Databricks applies per endpoint and per workspace. A request over the limit returns HTTP 429 Too Many Requests. Retry with exponential backoff: double the wait after each 429, and cap both the wait time and the number of retries. Add jitter so that many clients don't all retry at the same moment. If the response includes a Retry-After header, wait at least that long.

    Sources1

    4.Monitoring pipelines: updates and events

    A pipeline doesn't have job runs. It has updates, and each update produces events. The pipeline event log records audit logs, data quality checks, pipeline progress and data lineage. You can read it in the monitoring UI, by querying the event log directly, or through the Pipelines REST API, which the CLI wraps.

    The pipelines command group has two kinds of commands. Project commands such as logs and history identify a pipeline by KEY, its unique name in the project's YAML file. KEY is optional if the project contains only one pipeline. Object commands such as list-updates, get-update and list-pipeline-events take a PIPELINE_ID. Time filters differ between the two groups. pipelines logs and pipelines history take timestamp strings such as 2025-01-15T10:30:00Z, while jobs list-runs takes integer start-time values.

    Pipeline monitoring commands
    CommandIdentifies pipeline byWhat it returns / key options
    databricks pipelines historyKEYPast runs; --start-time, --end-time
    databricks pipelines logsKEYEvents (default: most recent update); --update-id, --level, --event-type, -n, --start-time, --end-time
    databricks pipelines list-updatesPIPELINE_IDUpdates; --max-results, --page-token, --until-update-id
    databricks pipelines get-updatePIPELINE_ID and UPDATE_IDOne update
    databricks pipelines list-pipeline-eventsPIPELINE_IDEvents; --filter (SQL-like), --max-results, --page-token
    Fetching the first 10 events of a specific updatebash
    databricks pipelines logs pipeline-name --update-id update-1 -n 10

    Checkpoint 5 of 9· Fill the gap

    You want only error and metric events of type update_progress after a given time. Which flag completes the command?

    databricks pipelines logs pipeline-name  ?  ERROR,METRICS --event-type update_progress --start-time 2025-01-15T10:30:00Z

    Checkpoint 6 of 9· Match them up

    Match each pipelines command to what it retrieves

    Tap a term, then the definition that fits it.

    Checkpoint 7 of 9· Exam question

    A multi-task Lakeflow Job fails partway through: two downstream tasks that depend on a failed upstream task also end up in a failed state, while several unrelated tasks in the same run succeeded. An on-call engineer wants to retry only the failed upstream task and have its dependents re-execute automatically, without re-running the tasks that already succeeded. Which use of the Jobs API accomplishes this?

    Sources67

    5.Scripting it in Python: the Databricks SDK

    When a monitoring task grows into an application, the Databricks SDK for Python is the recommended route. It is in Beta and is okay to use in production. During the Beta, pin the specific minor version your code depends on. You start by creating a WorkspaceClient. With no arguments, it uses the Databricks unified authentication standard: it reads a configuration profile named by DATABRICKS_CONFIG_PROFILE, or the environment variables for your authentication type. You can hard-code host and token, but that is not recommended because it risks exposing secrets such as personal access tokens.

    Inside a notebook it's simpler. The SDK is installed by default on clusters running Databricks Runtime 13.3 LTS or above. On older runtimes you install it, or upgrade it, with %pip. Default notebook authentication uses a temporary personal access token that Databricks creates in the background and deletes after the notebook stops. It has three limits: it works only on the driver node, not with configuration profiles, and not with Databricks Container Services. To call account-level APIs, use OAuth M2M, OAuth U2M or personal access token authentication instead.

    Installing or upgrading the SDK on the attached cluster from a notebookpython
    %pip install databricks-sdk --upgrade

    Checkpoint 8 of 9· Check yourself

    A notebook uses WorkspaceClient() with default notebook authentication. Code that runs inside a UDF on the executors tries to call the Jobs API and fails to authenticate. Why?

    Checkpoint 9 of 9· Exam question

    A run of `job_id=9012` has now been repaired three times using the repair-run endpoint, and the on-call team needs to build a dashboard that reconstructs the full repair history for the run: which attempt is the original failure, which attempt is currently the latest, and how the attempts chain together. Which fields returned by the Jobs API should the dashboard read to reconstruct this chain? (Select all that apply.)(Select 3)

    Sources8

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.The CLI and the REST API are separate surfaces, so some job information is only available through one of them.Why is that wrong?

      The CLI wraps the REST API, and most commands map to a REST request. For example, databricks jobs get corresponds to GET /api/2.2/jobs/get.

      Covered in One API, three ways in

    2. 2.A single get-run call always returns every task of a large multi-task run.Why is that wrong?

      Array properties such as tasks return only their first 100 elements. You must follow next_page_token with --page-token to get the rest.

      Covered in Finding and inspecting job runs

    3. 3.get-run-output returns the full output of a task, however large.Why is that wrong?

      The API returns only the first 5 MB of output. Larger results should be stored in a cloud storage service.

      Covered in Finding and inspecting job runs

    4. 4.databricks pipelines logs with no filters shows the pipeline's entire event history.Why is that wrong?

      Without --update-id, it shows only the events of the most recent update.

      Covered in Monitoring pipelines: updates and events

    Sources

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Databricks recommends using the Databricks SDKs or the Databricks CLI instead of the Databricks REST API”
      ↩︎ One API, three ways in
      “Workspace APIs manage resources inside a single workspace, such as clusters, jobs, notebooks, and Unity Catalog objects”
      ↩︎ Calling the REST API directly: paging and rate limits
      “A request that exceeds the rate limit returns an HTTP 429 Too Many Requests response.”
      ↩︎ Calling the REST API directly: paging and rate limits
      “If a response includes a Retry-After header, wait at least that long before retrying.”
      ↩︎ Calling the REST API directly: paging and rate limits
      “Repeat until a response omits next_page_token or returns it as an empty value. That response is the last page.”
      ↩︎ Checkpoint
    2. 2.
      “Use the REST API directly for use cases such as automating processes where an SDK in your preferred programming language is not currently available.”
      ↩︎ One API, three ways in
      “For example, databricks jobs get maps to GET/api/2.2/jobs/get.”
      ↩︎ Exam trap 1
      “Use the CLI for one-off tasks such as experimentation, shell scripting, and invoking the REST API directly”
      ↩︎ Checkpoint
    3. 3.
      “Databricks plans no support or new feature work for the legacy Databricks CLI.”
      ↩︎ One API, three ways in
      “The CLI wraps the Databricks REST API, which provides endpoints for modifying or requesting information about Databricks account and workspace objects.”
      ↩︎ Key concept
    4. 4.
      “List job runs in descending order by start time.”
      ↩︎ Finding and inspecting job runs
      “When a notebook task returns a value through the dbutils.notebook.exit() call, you can use this command to retrieve that value.”
      ↩︎ Finding and inspecting job runs
      “The run is canceled asynchronously, so it may still be running when this request completes.”
      ↩︎ Finding and inspecting job runs
      “Large arrays in the results will be paginated when they exceed 100 elements.”
      ↩︎ Exam trap 2
      “Databricks restricts this API to returning the first 5 MB of the output.”
      ↩︎ Exam trap 3
      “Runs are automatically removed after 60 days.”
      ↩︎ Checkpoint
    5. 5.
      “If you have access to the system.lakeflow schema, you can also view and query records of job runs and tasks from across your account.”
      ↩︎ Finding and inspecting job runs
    6. 6.
      “You can view event log entries in the pipeline monitoring user interface, the Pipelines REST API, or by directly querying the event log.”
      ↩︎ Monitoring pipelines: updates and events
    7. 7.
      “Filter events by list of log levels (INFO, WARN, ERROR, METRICS)”
      ↩︎ Monitoring pipelines: updates and events
      “Filter events by update ID. If not provided, uses the most recent update ID”
      ↩︎ Exam trap 4
      “Retrieve events for the pipeline identified by KEY. By default, this command shows the events of the pipeline's most recent update.”
      ↩︎ Prediction
      “Criteria to select a subset of results, expressed using a SQL-like syntax.”
      ↩︎ Checkpoint
    8. 8.
      “The Databricks SDK for Python is in Beta and is okay to use in production.”
      ↩︎ Scripting it in Python: the Databricks SDK
      “It is installed by default on all Databricks clusters that use Databricks Runtime 13.3 LTS or above.”
      ↩︎ Scripting it in Python: the Databricks SDK
      “Databricks notebook authentication does not work with Databricks configuration profiles.”
      ↩︎ Scripting it in Python: the Databricks SDK
      “Default Databricks notebook authentication works only on the cluster's driver node and not on any of the cluster's worker or executor nodes.”
      ↩︎ Checkpoint

    Ready to test yourself?

    Practise Databricks Certified Data Engineer Professional in quiz mode.

    Spotted a mistake, or was something unclear? Tell us.