Class JobsAPI
- java.lang.Object
-
- com.databricks.sdk.service.jobs.JobsAPI
-
@Generated public class JobsAPI extends Object
The Jobs API allows you to create, edit, and delete jobs.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 Summary
Constructors Constructor Description JobsAPI(ApiClient apiClient)
Regular-use constructorJobsAPI(JobsService mock)
Constructor for mocks
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancelAllRuns(long jobId)
void
cancelAllRuns(CancelAllRuns request)
Cancel all runs of a job.Wait<Run,Void>
cancelRun(long runId)
Wait<Run,Void>
cancelRun(CancelRun request)
Cancel a job run.CreateResponse
create(CreateJob request)
Create a new job.void
delete(long jobId)
void
delete(DeleteJob request)
Delete a job.void
deleteRun(long runId)
void
deleteRun(DeleteRun request)
Delete a job run.ExportRunOutput
exportRun(long runId)
ExportRunOutput
exportRun(ExportRunRequest request)
Export and retrieve a job run.Job
get(long jobId)
Job
get(GetJobRequest request)
Get a single job.Run
getRun(long runId)
Run
getRun(GetRunRequest request)
Get a single job run.RunOutput
getRunOutput(long runId)
RunOutput
getRunOutput(GetRunOutputRequest request)
Get the output for a single run.JobsService
impl()
Iterable<BaseJob>
list(ListJobsRequest request)
List jobs.Iterable<BaseRun>
listRuns(ListRunsRequest request)
List job runs.Wait<Run,RepairRunResponse>
repairRun(long runId)
Wait<Run,RepairRunResponse>
repairRun(RepairRun request)
Repair a job run.void
reset(long jobId, JobSettings newSettings)
void
reset(ResetJob request)
Overwrites all settings for a job.Wait<Run,RunNowResponse>
runNow(long jobId)
Wait<Run,RunNowResponse>
runNow(RunNow request)
Trigger a new job run.Wait<Run,SubmitRunResponse>
submit(SubmitRun request)
Create and trigger a one-time run.void
update(long jobId)
void
update(UpdateJob request)
Partially update a job.Run
waitGetRunJobTerminatedOrSkipped(long runId)
Run
waitGetRunJobTerminatedOrSkipped(long runId, Duration timeout, Consumer<Run> callback)
-
-
-
Constructor Detail
-
JobsAPI
public JobsAPI(ApiClient apiClient)
Regular-use constructor
-
JobsAPI
public JobsAPI(JobsService mock)
Constructor for mocks
-
-
Method Detail
-
waitGetRunJobTerminatedOrSkipped
public Run waitGetRunJobTerminatedOrSkipped(long runId) throws TimeoutException
- Throws:
TimeoutException
-
waitGetRunJobTerminatedOrSkipped
public Run waitGetRunJobTerminatedOrSkipped(long runId, Duration timeout, Consumer<Run> callback) throws TimeoutException
- Throws:
TimeoutException
-
cancelAllRuns
public void cancelAllRuns(long jobId)
-
cancelAllRuns
public void cancelAllRuns(CancelAllRuns request)
Cancel all runs of a job.Cancels all active runs of a job. The runs are canceled asynchronously, so it doesn't prevent new runs from being started.
-
cancelRun
public Wait<Run,Void> cancelRun(CancelRun request)
Cancel a job run.Cancels a job run. The run is canceled asynchronously, so it may still be running when this request completes.
-
create
public CreateResponse create(CreateJob request)
Create a new job.Create a new job.
-
delete
public void delete(long jobId)
-
delete
public void delete(DeleteJob request)
Delete a job.Deletes a job.
-
deleteRun
public void deleteRun(long runId)
-
deleteRun
public void deleteRun(DeleteRun request)
Delete a job run.Deletes a non-active run. Returns an error if the run is active.
-
exportRun
public ExportRunOutput exportRun(long runId)
-
exportRun
public ExportRunOutput exportRun(ExportRunRequest request)
Export and retrieve a job run.Export and retrieve the job run task.
-
get
public Job get(long jobId)
-
get
public Job get(GetJobRequest request)
Get a single job.Retrieves the details for a single job.
-
getRun
public Run getRun(long runId)
-
getRun
public Run getRun(GetRunRequest request)
Get a single job run.Retrieve the metadata of a run.
-
getRunOutput
public RunOutput getRunOutput(long runId)
-
getRunOutput
public RunOutput getRunOutput(GetRunOutputRequest request)
Get the output for a single run.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.
-
list
public Iterable<BaseJob> list(ListJobsRequest request)
List jobs.Retrieves a list of jobs.
-
listRuns
public Iterable<BaseRun> listRuns(ListRunsRequest request)
List job runs.List runs in descending order by start time.
-
repairRun
public Wait<Run,RepairRunResponse> repairRun(long runId)
-
repairRun
public Wait<Run,RepairRunResponse> repairRun(RepairRun request)
Repair a job run.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.
-
reset
public void reset(long jobId, JobSettings newSettings)
-
reset
public void reset(ResetJob request)
Overwrites all settings for a job.Overwrites all the settings for a specific job. Use the Update endpoint to update job settings partially.
-
runNow
public Wait<Run,RunNowResponse> runNow(long jobId)
-
runNow
public Wait<Run,RunNowResponse> runNow(RunNow request)
Trigger a new job run.Run a job and return the `run_id` of the triggered run.
-
submit
public Wait<Run,SubmitRunResponse> submit(SubmitRun request)
Create and trigger a one-time run.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.
-
update
public void update(long jobId)
-
update
public void update(UpdateJob request)
Partially update a job.Add, update, or remove specific settings of an existing job. Use the ResetJob to overwrite all job settings.
-
impl
public JobsService impl()
-
-