Trigger jobs when upstream jobs complete
Use job completion triggers to run a Lakeflow Job when one or more upstream jobs finish. Upstream jobs can be in different workspaces attached to the same Unity Catalog metastore. You can configure the dependency on the downstream job without changing the upstream jobs.
Job completion triggers are in Beta.
Before you begin
- A workspace admin must enable Job Completion Triggers from the Previews page in the downstream workspace and every upstream workspace.
- All participating workspaces must be attached to the same Unity Catalog metastore.
- You must have CAN MANAGE on the downstream job to configure its trigger.
- The downstream job's Run as identity must be assigned to every upstream workspace and have CAN VIEW or higher on every monitored job. These requirements apply to both users and service principals.
Your own permissions determine which jobs you can select and open. The downstream job's Run as permissions determine whether the trigger can monitor them.
How job completion triggers work
A trigger monitors 1 to 10 upstream jobs and applies the same result filter to all of them:
Upstream run result | API value | Matching completions |
|---|---|---|
Succeeded (default) |
|
|
Failed |
| Any termination code other than |
Completed with any result |
| Any completed run, regardless of termination code |
With one upstream job, each new matching completion starts a downstream run. With multiple upstream jobs, a downstream run starts after all jobs have a new matching completion. If a job completes more than one time before the others complete, the latest matching completion from that job contributes to the downstream run.
For example, if A completes twice and then B completes, a trigger monitoring A and B starts one downstream run using A's second completion and B's completion. Both jobs must contribute another matching completion to start the next run. Completions are not matched by business date or data batch.
To run after any upstream job completes, add separate triggers, one for each job. This requires the Multiple Triggers Beta.
Historical completions do not start runs when the trigger initializes. Changing the monitored jobs or result filter resets completion progress and starts monitoring afresh. If the downstream job reaches its maximum concurrent runs, ready completions are retained until it can start another run.
Add a job completion trigger
- In the workspace sidebar, click Jobs & Pipelines, then open the downstream job.
- In Schedules & Triggers, click Add trigger.
- For Trigger type, select Upstream job completion.
- Under Upstream jobs, select each Job workspace and Job. Search by job name or ID.
- Select the Upstream run result.
- Click Test trigger and resolve any reported errors. If an upstream job cannot be verified during this test, check the trigger's status after saving.
- Click Save.
Use Schedules & Triggers to inspect each upstream job's completion progress, edit the trigger, or pause, resume, and delete it. Pausing a trigger does not stop active runs. See Manage existing triggers.
Viewers of the downstream job can see upstream workspace, job & run IDs, completion results, and progress. Job names and access to upstream jobs and runs require the viewer's own upstream permissions.
Configure with the API, CLI, or bundles
- REST API
- CLI
- Bundles
Save this request as update-job.json and send it to POST /api/2.2/jobs/update in the Jobs API. Replace the IDs with your downstream job and upstream workspace & job IDs.
{
"job_id": 9001,
"new_settings": {
"triggers": [
{
"pause_status": "UNPAUSED",
"job_completion": {
"jobs": [
{ "workspace_id": "123456789", "job_id": "1001" },
{ "workspace_id": "234567890", "job_id": "1002" }
],
"if_status": "SUCCESS"
}
}
]
}
}
Save the request body from the REST API tab as update-job.json, then run:
databricks api post /api/2.2/jobs/update --json @update-job.json
For a Databricks Asset Bundle, add the following settings to an existing job resource, alongside its tasks:
resources:
jobs:
downstream:
triggers:
- pause_status: UNPAUSED
job_completion:
jobs:
- workspace_id: '123456789'
job_id: '1001'
- workspace_id: '234567890'
job_id: '1002'
if_status: SUCCESS
These examples require the Multiple Triggers Beta. For a single trigger without that Beta, use trigger with the same trigger object instead of the triggers array. Do not combine triggers with trigger, schedule, or continuous. Updating triggers replaces the entire array, so include any existing triggers you want to keep. Bundle validation and deployment require a CLI version whose schema includes job_completion.
Use the upstream completion details
Add a job parameter named upstream_completions with the value {{job.trigger.job_completion.completed_jobs}}. It resolves to a JSON array with one entry per monitored job, in configuration order:
[
{
"workspace_id": "123456789",
"job_id": "1001",
"run_id": "2001",
"termination_code": "SUCCESS",
"completion_time": "2026-10-07T08:00:00Z"
}
]
This example shows one entry. A trigger monitoring two jobs returns two entries. Retries and repairs retain the original contributing completions. Manual runs resolve the reference to []. You can configure this reference only when all of the job's triggers are job completion triggers.
A notebook task can read the parameter as follows:
import json
completed_jobs = json.loads(dbutils.widgets.get("upstream_completions"))
for job in completed_jobs:
print(job["job_id"], job["run_id"], job["termination_code"])
See Parameterize jobs. The same completion details are available in trigger_info.job_completion.completed_jobs in the Get run API for both single triggers and the Multiple Triggers Beta. To inspect each trigger's completion progress with Multiple Triggers, call the Get job API with include_trigger_state=true and read trigger_details[].state.job_completion.monitored_job_states.
Troubleshooting
Issue | Action |
|---|---|
Run as identity lacks job permissions or workspace access | Assign the identity to each upstream workspace and grant CAN VIEW or higher on each monitored job. |
Upstream job or workspace no longer exists | Remove or replace the affected entry. |
Workspaces have different metastores | Select upstream jobs in workspaces attached to the downstream workspace's metastore. |
Beta disabled in a participating workspace | Ask a workspace admin to enable Job Completion Triggers there. |
Limitations
- A workspace supports up to 1,000 active job completion triggers. These count toward the workspace limit of 12,000 active triggers.
- A trigger monitors at most 10 distinct workspace & job pairs.
- All monitored jobs share one result filter.