Serverless Migration API
FIRST: Use the parent
skill for CLI installation, authentication, and profile selection.
Use the Compute Migrations API through the Databricks CLI to migrate a job to serverless. The service analyzes the job, backs it up, builds a serverless working copy, and optionally runs it in the background. Your part is to track the migration, review the working copy, present the changes to the user, and carry out their decision. Applying the changes to the original job requires the user's explicit approval.
When to Use This Skill
Use it when the user asks you to:
- migrate one job or many jobs to serverless,
- write a script that starts and tracks migrations,
- check on, approve, reject, or cancel migrations already in progress, or
- find the backup a migration took of a job.
Use
databricks-serverless-migration
for direct code edits, notebooks, pipelines, JAR tasks, or a job this service cannot migrate. For job definitions maintained in source control, read
Jobs managed from source.
See the
migration guide for supported workloads and limits. A successful
starts the migration; it does not establish that the workload is compatible. Incompatibilities can be discovered during planning or working-copy creation.
Migrate One Job
- Check the prerequisites once per workspace.
- Confirm the job and whether to set or (see Settings chosen at creation).
- Start the migration with , and record its migration ID and .
- Track progress until it reaches a review gate or a terminal state.
- At each review gate, review the working copy, present your findings to the user, and approve or reject as the user decides.
- After , verify the original job and report the result and the backup folder.
For a list of jobs, use Bulk migration to repeat this workflow and track each job's decisions.
Prerequisites
- CLI v1.24.0 or newer: check and
databricks compute-migrations --help
. The command group and the verbs below must be available. If a command is missing, upgrade using .
- Compute Agent preview enabled in the workspace. A workspace admin enables it under Previews. Without it, every call fails with ("Migration APIs are not enabled for this workspace").
- CAN_MANAGE on each job you migrate.
The CLI help is generated from the API and is authoritative for command names, arguments, and flags. Run
databricks compute-migrations <command> --help
before first use of each command. Pass request bodies with
and read responses with
.
Lifecycle
Prepare working copy
→ TRANSLATION_READY (skipped when auto_approve=true)
→ Optional validation run (run_validation=true)
→ MIGRATION_REVIEW (execution approval required)
→ Apply changes → MIGRATION_COMPLETE
- Planning. The service reads the job, its notebooks and files, and its cluster configuration, and works out the serverless changes: compute, dependencies, Spark configs, and code changes. The working copy is the first thing you review.
- Backup and working copy. The service saves a backup of the job and its workspace files (see Backups), then creates a working copy: a new job named
[Serverless Migration - <timestamp>] <job name>
, tagged serverless_migration_source_job_id=<original job id>
, running copies of the job's notebooks and files. The original job is not modified until you approve execution.
- Gate 1, . Skipped when . Otherwise, review the working copy. Approve to continue, or reject with a reason to request changes.
- Validation run (only with ). Databricks runs the working-copy job once. The outcome is recorded in . A failed run does not stop the migration: it moves to with .
- Gate 2, . Final approval to update the original job. Approving execution starts applying the working copy's settings and file contents to the original job, keeping its job ID, schedule, and permissions.
- Complete. Verify the original job (see After completion).
Use either rejection command to
request changes, with a specific
. The same migration returns to planning and revises its working copy. Read
again and review the current copy before approving it. Revisions are limited, and repeated rejections eventually fail the migration. When the user wants to stop the migration, use
(see
Cancellation).
Settings Chosen at Creation
and
are fixed when the migration is created and cannot be changed. Both default to
. Set either one only when the user asks for it.
| Field | Effect | Risk |
|---|
| Skips gate 1 (). Gate 2 still waits for a decision. | With , the working copy runs before the user reviews it. |
| Runs the working-copy job once before gate 2. | The run is real: see below. |
A validation run is not sandboxed. The working copy runs in the same workspace against the same tables, volumes, checkpoints, and external systems as the original job, with the agent's changes applied. If the job is not idempotent, or has side effects, the validation run produces them. Examples: overwriting or appending to production tables, merges, sending emails or notifications, calling external APIs, triggering downstream jobs, or advancing streaming offsets and checkpoints. Enable
only after the user confirms that one extra run of this job, right now, is safe, for example because the job is idempotent or writes only to test outputs. Never turn it on across a batch of jobs without that confirmation for each job.
Commands
| Operation | Command | Notes |
|---|
| Start | create --json '<migration>' --request-id <uuid>
| is ; is . |
| Read one | | Current state, reports, . |
| Read many | | Returns a JSON array with and paginates automatically. Filter the returned values locally. Eventually consistent: confirm with before acting. |
| Gate 1 | approve-migration-translation <migration_id>
/ reject-migration-translation <migration_id> <rejection_reason>
| Reject takes the reason as a positional argument or as in . Approve accepts optional . |
| Gate 2 | approve-migration-execution <migration_id>
/ reject-migration-execution <migration_id> <rejection_reason>
| Same arguments and flags as gate 1. |
| Stop | cancel-migration <migration_id>
| Any non-terminal state. Optional . Does not undo applied changes; see Cancellation. |
| Remove record | | Hides the record and frees the job for a new migration. Rolls nothing back and cleans nothing up. Use to stop an in-flight migration. |
All commands are under
databricks compute-migrations
. Start a migration:
bash
databricks compute-migrations create -o json --request-id "<uuid>" --json '{
"asset_type": "JOB",
"asset_uri": "jobs/<job_id>",
"auto_approve": false,
"run_validation": false
}'
Generate a fresh
per job and reuse it when retrying that job's
after a timeout or network error. The server returns the existing migration instead of creating a duplicate.
Pass the
from your latest
on every approve, reject, and cancel, so the call fails rather than acting on a state you have not seen:
bash
databricks compute-migrations reject-migration-translation <migration_id> -o json --json '{
"etag": "<etag>",
"rejection_reason": "Keep the existing output table names; task ingest writes to a different table in the working copy."
}'
| Error | Meaning | Action |
|---|
| The job has a migration in progress, or one that already migrated it. | Find and confirm the existing migration as described below. |
| Bad request, or the job cannot be migrated. | Read the message; do not retry unchanged. |
| No CAN_MANAGE on the job, or the preview is not enabled. | Report to the user. |
| Gate call made in the wrong state. | , then act on the current state. |
| The is stale. | , re-check the state, retry with the new . |
After
, take the migration ID from the error and confirm its
and state with
. If the existing migration is
, report the job as already migrated. Do not delete the record and create another migration unless the user explicitly requests it.
Tracking Progress
Migrations take minutes to hours: planning and building the working copy usually take several minutes, and a validation run takes as long as the job. Use your harness's monitoring capabilities to track progress.
returns the current migration state; for many migrations, use
and confirm each one with
before acting.
| State | What to do |
|---|
| , , | Planning is in progress. |
| , | Working-copy creation is in progress. |
| , | Validation is in progress. |
| , , | Migration is in progress. |
| Review the working copy, present it to the user, then approve or reject gate 1. |
| Review the working copy and , present them, then approve or reject gate 2. |
| Verify the original job. |
| The job cannot be migrated automatically. Report the reason from , and offer databricks-serverless-migration
for a manual migration. |
| Report the reason from . If the migration failed during , check whether the original job was partly changed (see Backups). |
| Report the cancellation and check for applied changes or active validation runs as described in Cancellation. |
| Any other state | Read the migration again with . If the state is still unrecognized, report it and stop automatic progress handling; do not assume it is in progress. |
lists every state entered, with
, the reviewer's
, and the system's
(for example, the reason for a failure).
Cancellation
Cancellation does not undo changes already applied to the original job or files, or side effects of validation runs. An operation already in progress may finish after the migration reports
; that state alone does not confirm that all work has stopped.
If execution was approved, or
includes
or
, inspect the original job and files against the saved review record and backup. Report which changes are present and anything you cannot verify. Check active working-copy runs separately with
databricks jobs list-runs --job-id <working_copy_job_id> --active-only -o json
. Retain the recovery artifacts if the result is unverified or work may still be active.
Reviewing a Working Copy
The API returns links to the working copy, not a diff, so build the comparison yourself:
- the migration.
migration_report.primary_asset.id
is the working-copy job's ID.
- Compare job settings:
databricks jobs get <original_job_id> -o json
against databricks jobs get <working_copy_job_id> -o json
. Expect classic compute (, , ) to be replaced by serverless settings ( and ), libraries to move into environment dependencies, unsupported Spark configs and init scripts to be removed, and possibly a performance mode to be set. The job name prefix, the serverless_migration_source_job_id
tag, and task paths pointing at the copied notebooks are expected differences.
- Compare code. The working-copy job's task settings name the notebooks and files it runs. Match its tasks to the original job's by , and take each task's path (
notebook_task.notebook_path
or spark_python_task.python_file
) from both jobs. For , inspect its inner too. Export each to a separate local file with databricks workspace export <path> --format SOURCE --file <local_file>
and diff them. Also inspect utility notebooks invoked by the task notebooks for changes, such as through or .
- If a validation run happened, report , , and . For a failed run, inspect it with
databricks jobs get-run <run_id> -o json
. Take the run ID from .
- Summarize the changes per task, including which tasks will migrate and which will stay on classic. Flag anything beyond a compatibility fix: changed business logic, different output tables or paths, removed steps, or dropped dependencies.
- Before approving execution, save the reviewed job settings and exported code, including utility notebooks, in a local folder for this migration ID. Include the original task paths, the working-copy-to-original path mapping, and the tasks approved for migration or intentionally kept on classic. This review record is needed after the working copy is deleted. Refresh it after any revision and review.
- Get the user's decision. A rejection reason should name the task and the specific change to make.
Rules while a migration is in progress:
- Approve gate 2 only with explicit user approval covering that job ID. A single decision may approve an explicitly identified set of jobs; the approval must cover the reviewed changes for each job.
- Do not edit the original job. Approving execution replaces its settings and files with the working copy's, discarding later edits.
- Do not edit the working copy to change the outcome. Reject with a reason instead.
After Completion
When the API reports
, verify the original job before reporting success:
- Read
databricks jobs get <job_id> -o json
and compare it with the saved review record. Tasks approved for migration must have the reviewed serverless settings; tasks intentionally left on classic must retain their reviewed configuration. Account for the original job name and task paths, and removal of the working-copy tag.
- Export the original task notebooks and files, including those used by nested tasks, along with the reviewed utility notebooks. Compare them with the saved reviewed code.
If approved changes are missing or differ from the review record, report the mismatch and offer to restore from the backup. Before retrying, restore any job settings or files changed by this migration from the pre-migration backup, with the user's approval. Then
the migration (which frees the job) and create a new one. If the review record is unavailable, explain which parts of the result you could verify and which remain unverified.
The working-copy job or its copied files may remain after a successful migration. Report any leftovers and offer cleanup.
Report the migration ID, final state, original job, what changed, tasks left on classic, and the backup folder.
Backups
Before building the working copy, the service writes a backup to the workspace home of the identity that created the migration.
Files that tasks load from a Git repository are not copied; they stay in the repository. A new timestamped backup folder is written each time the service builds a working copy. Migrations never delete backups. Give the user the backup folder for every migration that reached
or later.
There is no rollback command. For the backup location and file layout, restore instructions, and working-copy cleanup, follow Backups and rollback.
Bulk Migration
For multiple jobs, follow Bulk migration. It applies the single-job workflow to each migration, with separate tracking, settings, review records, and approval decisions.
Jobs Managed from Source
A migration changes the job in the workspace. If the job's definition comes from source, the next deploy reverts the migration. This covers jobs deployed from a Declarative Automation Bundle (
is
) and jobs managed by Terraform or CI. For these jobs, tell the user before creating a migration. Either migrate the source (
databricks-serverless-migration
,
), or use the reviewed working copy as the reference for changes to make in the source.
Documentation