# Run Databricks Job & Wait
URL: /recipes/databricks-run-job-and-wait
Type: howto
Description: Trigger a Databricks Job by ID, poll the run to completion, then branch on whether it succeeded — the pre-wired pairing of Run Job and Get Job Run.
Keywords: run databricks job & wait, databricks-run-job-and-wait, recipe, workflow template, workflow builder, databricks
Trigger a Databricks Job by ID, poll the run to completion, then branch on whether it succeeded — the pre-wired pairing of Run Job and Get Job Run.

<Callout type="info">
  **Prerequisites:** Connect **Databricks** before adding this recipe. See [Integrations](/integrations).
</Callout>

How it works [#how-it-works]

Each box is a block; arrows show the order Stylo runs them, and branch labels show the path taken on each outcome.

<Mermaid
  chart="flowchart TD
  trigger[&#x22;Every Morning&#x22;]
  run_job[&#x22;Run Databricks Job&#x22;]
  poll_loop[&#x22;Poll Until Complete&#x22;]
  check_status[&#x22;Check Run Status&#x22;]
  poll_delay[&#x22;Wait Between Polls&#x22;]
  final_status[&#x22;Get Final Result&#x22;]
  check_success[&#x22;Succeeded?&#x22;]
  trigger --> run_job
  run_job --> poll_loop
  check_status --> poll_delay
  poll_loop --> final_status
  final_status --> check_success"
/>

Parameters [#parameters]

Set these when you add the recipe to your workspace:

| Parameter          | Type   | Default |
| ------------------ | ------ | ------- |
| `job_id`           | string | —       |
| `poll_interval_ms` | number | `10000` |

Blocks used [#blocks-used]

Every block in this recipe, linked to its reference page where one exists:

| Block                                           | Type                     | What it does                                                                                                                                 |
| ----------------------------------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| [Schedule](/reference/blocks/trigger-schedule)  | `trigger/schedule`       | Trigger workflow on a cron schedule                                                                                                          |
| Run Job                                         | `databricks/run-job`     | Trigger an existing Databricks Job by ID (run-now). Returns immediately with the run ID — pair with Get Job Run to poll for completion.      |
| [Loop](/reference/blocks/system-loop)           | `system/loop`            | Iterate over items, a fixed count, or while a condition is true                                                                              |
| Get Job Run                                     | `databricks/get-job-run` | Fetch the status (and optional output) of a Databricks job run. Poll this until isTerminal is true.                                          |
| [Delay](/reference/blocks/system-delay)         | `system/delay`           | Pause the workflow before continuing. Top-level delays use durable execution and may run for minutes; delays inside a loop are short (≤30s). |
| [Condition](/reference/blocks/system-condition) | `system/condition`       | Branch the workflow based on a boolean expression                                                                                            |

When to use it [#when-to-use-it]

Use this when a workflow needs a Databricks Job to finish before it continues — not just fire it off. It triggers the job, polls the run until it reaches a terminal state, then branches on whether the run succeeded, so downstream steps only act on a completed result.

Adapt it [#adapt-it]

This recipe is a starting point. To fit it to your workspace:

* Set the `job_id` parameter to the numeric ID of the Databricks Job you want to run.
* Tune the `poll_interval_ms` parameter to control how long the loop waits between status checks (in-loop delays are capped at 30 seconds).
* Raise or lower the **Poll Until Complete** loop's max-iterations cap to match how long the job can reasonably run before you give up.
* Fill in the &#x2A;*Succeeded?** branches with what should happen on success (e.g. read `Get Final Result.output`) versus failure (e.g. alert on `resultState`).

Related [#related]

* [All recipes](/recipes)
* [Workflow blocks reference](/reference/blocks)
* [Workflow Builder overview](/workflow-builder-overview)
* [Integrations](/integrations)