@Generated public class JobsAPI extends Object
You can use a Databricks job to run a data processing or data analysis task in a Databricks cluster with scalable resources. Your job can consist of a single task or can be a large, multi-task workflow with complex dependencies. Databricks manages the task orchestration, cluster management, monitoring, and error reporting for all of your jobs. You can run your jobs immediately or periodically through an easy-to-use scheduling system. You can implement job tasks using notebooks, JARS, Spark Declarative Pipelines, or Python, Scala, Spark submit, and Java applications.
You should never hard code secrets or store them in plain text. Use the [Secrets CLI] to manage secrets in the [Databricks CLI]. Use the [Secrets utility] to reference secrets in notebooks and jobs.
[Databricks CLI]: https://docs.databricks.com/dev-tools/cli/index.html [Secrets CLI]: https://docs.databricks.com/dev-tools/cli/secrets-cli.html [Secrets utility]: https://docs.databricks.com/dev-tools/databricks-utils.html#dbutils-secrets
| Constructor and Description |
|---|
JobsAPI(ApiClient apiClient)
Regular-use constructor
|
JobsAPI(JobsService mock)
Constructor for mocks
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancelAllRuns(CancelAllRuns request)
Cancels all active runs of a job.
|
Wait<Run,Void> |
cancelRun(CancelRun request)
Cancels a job run or a task run.
|
Wait<Run,Void> |
cancelRun(long runId) |
CreateResponse |
create(CreateJob request)
Create a new job.
|
void |
delete(DeleteJob request)
Deletes a job.
|
void |
delete(long jobId) |
void |
deleteRun(DeleteRun request)
Deletes a non-active run.
|
void |
deleteRun(long runId) |
ExportRunOutput |
exportRun(ExportRunRequest request)
Export and retrieve the job run task.
|
ExportRunOutput |
exportRun(long runId) |
Job |
get(GetJobRequest request)
Retrieves the details for a single job.
|
Job |
get(long jobId) |
GetJobPermissionLevelsResponse |
getPermissionLevels(GetJobPermissionLevelsRequest request)
Gets the permission levels that a user can have on an object.
|
GetJobPermissionLevelsResponse |
getPermissionLevels(String jobId) |
JobPermissions |
getPermissions(GetJobPermissionsRequest request)
Gets the permissions of a job.
|
JobPermissions |
getPermissions(String jobId) |
Run |
getRun(GetRunRequest request)
Retrieves the metadata of a run.
|
Run |
getRun(long runId) |
RunOutput |
getRunOutput(GetRunOutputRequest request)
Retrieve the output and metadata of a single task run.
|
RunOutput |
getRunOutput(long runId) |
JobsService |
impl() |
Iterable<BaseJob> |
list(ListJobsRequest request)
Retrieves a list of jobs.
|
Iterable<BaseRun> |
listRuns(ListRunsRequest request)
List runs in descending order by start time.
|
Wait<Run,RepairRunResponse> |
repairRun(RepairRun request)
Re-run one or more tasks.
|
void |
reset(ResetJob request)
Overwrite all settings for the given job.
|
Wait<Run,RunNowResponse> |
runNow(RunNow request)
Run a job and return the `run_id` of the triggered run.
|
JobPermissions |
setPermissions(JobPermissionsRequest request)
Sets permissions on an object, replacing existing permissions if they exist.
|
Wait<Run,SubmitRunResponse> |
submit(SubmitRun request)
Submit a one-time run.
|
void |
update(UpdateJob request)
Add, update, or remove specific settings of an existing job.
|
JobPermissions |
updatePermissions(JobPermissionsRequest request)
Updates the permissions on a job.
|
Run |
waitGetRunJobTerminatedOrSkipped(Long runId) |
Run |
waitGetRunJobTerminatedOrSkipped(Long runId,
Duration timeout,
Consumer<Run> callback) |
public JobsAPI(ApiClient apiClient)
public JobsAPI(JobsService mock)
public Run waitGetRunJobTerminatedOrSkipped(Long runId) throws TimeoutException
TimeoutExceptionpublic Run waitGetRunJobTerminatedOrSkipped(Long runId, Duration timeout, Consumer<Run> callback) throws TimeoutException
TimeoutExceptionpublic void cancelAllRuns(CancelAllRuns request)
public Wait<Run,Void> cancelRun(CancelRun request)
public CreateResponse create(CreateJob request)
public void delete(long jobId)
public void delete(DeleteJob request)
public void deleteRun(long runId)
public void deleteRun(DeleteRun request)
public ExportRunOutput exportRun(long runId)
public ExportRunOutput exportRun(ExportRunRequest request)
public Job get(long jobId)
public Job get(GetJobRequest request)
Large arrays in the results will be paginated when they exceed 100 elements. A request for a single job will return all properties for that job, and the first 100 elements of array properties (`tasks`, `job_clusters`, `environments` and `parameters`). Use the `next_page_token` field to check for more results and pass its value as the `page_token` in subsequent requests. If any array properties have more than 100 elements, additional results will be returned on subsequent requests. Arrays without additional results will be empty on later pages.
public GetJobPermissionLevelsResponse getPermissionLevels(String jobId)
public GetJobPermissionLevelsResponse getPermissionLevels(GetJobPermissionLevelsRequest request)
public JobPermissions getPermissions(String jobId)
public JobPermissions getPermissions(GetJobPermissionsRequest request)
public Run getRun(long runId)
public Run getRun(GetRunRequest request)
Large arrays in the results will be paginated when they exceed 100 elements. A request for a single run will return all properties for that run, and the first 100 elements of array properties (`tasks`, `job_clusters`, `job_parameters` and `repair_history`). Use the next_page_token field to check for more results and pass its value as the page_token in subsequent requests. If any array properties have more than 100 elements, additional results will be returned on subsequent requests. Arrays without additional results will be empty on later pages.
public RunOutput getRunOutput(long runId)
public RunOutput getRunOutput(GetRunOutputRequest request)
This endpoint validates that the __run_id__ parameter is valid and returns an HTTP status code 400 if the __run_id__ parameter is invalid. Runs are automatically removed after 60 days. If you to want to reference them beyond 60 days, you must save old run results before they expire.
public Iterable<BaseJob> list(ListJobsRequest request)
public Iterable<BaseRun> listRuns(ListRunsRequest request)
public Wait<Run,RepairRunResponse> repairRun(RepairRun request)
public void reset(ResetJob request)
public Wait<Run,RunNowResponse> runNow(RunNow request)
public JobPermissions setPermissions(JobPermissionsRequest request)
public Wait<Run,SubmitRunResponse> submit(SubmitRun request)
**Important:** Jobs submitted using this endpoint are not saved as a job. They do not show up in the Jobs UI, and do not retry when they fail. Because they are not saved, Databricks cannot auto-optimize serverless compute in case of failure. If your job fails, you may want to use classic compute to specify the compute needs for the job. Alternatively, use the `POST /jobs/create` and `POST /jobs/run-now` endpoints to create and run a saved job.
public void update(UpdateJob request)
public JobPermissions updatePermissions(JobPermissionsRequest request)
public JobsService impl()
Copyright © 2026. All rights reserved.