@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, Delta Live Tables 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
|
public JobsAPI(ApiClient apiClient)
public JobsAPI(JobsService mock)
public Run waitGetRunJobTerminatedOrSkipped(Long runId) throws TimeoutException
TimeoutException
public Run waitGetRunJobTerminatedOrSkipped(Long runId, Duration timeout, Consumer<Run> callback) throws TimeoutException
TimeoutException
public void cancelAllRuns(CancelAllRuns request)
Cancels all active runs of a job. The runs are canceled asynchronously, so it doesn't prevent new runs from being started.
public Wait<Run,Void> cancelRun(CancelRun request)
Cancels a job run or a task run. The run is canceled asynchronously, so it may still be running when this request completes.
public CreateResponse create(CreateJob request)
Create a new job.
public void delete(long jobId)
public void delete(DeleteJob request)
Deletes a job.
public void deleteRun(long runId)
public void deleteRun(DeleteRun request)
Deletes a non-active run. Returns an error if the run is active.
public ExportRunOutput exportRun(long runId)
public ExportRunOutput exportRun(ExportRunRequest request)
Export and retrieve the job run task.
public Job get(long jobId)
public Job get(GetJobRequest request)
Retrieves the details for a single job.
public GetJobPermissionLevelsResponse getPermissionLevels(String jobId)
public GetJobPermissionLevelsResponse getPermissionLevels(GetJobPermissionLevelsRequest request)
Gets the permission levels that a user can have on an object.
public JobPermissions getPermissions(String jobId)
public JobPermissions getPermissions(GetJobPermissionsRequest request)
Gets the permissions of a job. Jobs can inherit permissions from their root object.
public Run getRun(long runId)
public Run getRun(GetRunRequest request)
Retrieve the metadata of a run.
public RunOutput getRunOutput(long runId)
public RunOutput getRunOutput(GetRunOutputRequest request)
Retrieve the output and metadata of a single task run. When a notebook task returns a value through the `dbutils.notebook.exit()` call, you can use this endpoint to retrieve that value. Databricks restricts this API to returning the first 5 MB of the output. To return a larger result, you can store job results in a cloud storage service.
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)
Retrieves a list of jobs.
public Iterable<BaseRun> listRuns(ListRunsRequest request)
List runs in descending order by start time.
public Wait<Run,RepairRunResponse> repairRun(long runId)
public Wait<Run,RepairRunResponse> repairRun(RepairRun request)
Re-run one or more tasks. Tasks are re-run as part of the original job run. They use the current job and task settings, and can be viewed in the history for the original job run.
public void reset(long jobId, JobSettings newSettings)
public void reset(ResetJob request)
Overwrite all settings for the given job. Use the Update endpoint to update job settings partially.
public Wait<Run,RunNowResponse> runNow(long jobId)
public Wait<Run,RunNowResponse> runNow(RunNow request)
Run a job and return the `run_id` of the triggered run.
public JobPermissions setPermissions(String jobId)
public JobPermissions setPermissions(JobPermissionsRequest request)
Sets permissions on a job. Jobs can inherit permissions from their root object.
public Wait<Run,SubmitRunResponse> submit(SubmitRun request)
Submit a one-time run. This endpoint allows you to submit a workload directly without creating a job. Runs submitted using this endpoint don’t display in the UI. Use the `jobs/runs/get` API to check the run state after the job is submitted.
public void update(long jobId)
public void update(UpdateJob request)
Add, update, or remove specific settings of an existing job. Use the ResetJob to overwrite all job settings.
public JobPermissions updatePermissions(String jobId)
public JobPermissions updatePermissions(JobPermissionsRequest request)
Updates the permissions on a job. Jobs can inherit permissions from their root object.
public JobsService impl()
Copyright © 2023. All rights reserved.