Databricks Data Engineer Professional Question 308
Select 3You are tasked with automating a workflow in Databricks. You need to clone an existing job, trigger a new run for the cloned job, and programmatically retrieve the output of the run using the Databricks REST API. Which of the following steps should you perform in the correct sequence to achieve this?
- A
Use the
POST /api/2.1/jobs/createendpoint with the job configuration details from the existing job. - B
Use the
POST /api/2.1/jobs/run-nowendpoint to trigger a run for the cloned job. - C
Use the
GET /api/2.1/jobs/exportendpoint to retrieve the configuration of the existing job. - D
Use the
GET /api/2.1/jobs/runs/get-outputendpoint to retrieve the output of the job run. - E
Use the
DELETE /api/2.1/jobs/deleteendpoint to remove the cloned job after retrieving its output.
Show answer and explanation
Correct answers: A, B, D
Explanation
To automate the workflow using the Databricks REST API, you first need to clone the existing job using the POST /api/2.1/jobs/create endpoint with the appropriate configuration. Once the job is cloned, you can trigger a run using the POST /api/2.1/jobs/run-now endpoint. Finally, to retrieve the output of the triggered run, use the GET /api/2.1/jobs/runs/get-output endpoint. Other endpoints like GET /api/2.1/jobs/export or DELETE /api/2.1/jobs/delete are not relevant in this specific scenario.
- A. Correct.
Correct. The
POST /api/2.1/jobs/createendpoint is used to create a new job, and you can provide the configuration of the existing job to clone it. - B. Correct.
Correct. The
POST /api/2.1/jobs/run-nowendpoint is used to trigger a run for the newly created (cloned) job. - C. Incorrect.
Incorrect. The
GET /api/2.1/jobs/exportendpoint is used to export job configurations, but it is not necessary in this workflow since you can directly create a new job using the configuration. - D. Correct.
Correct. The
GET /api/2.1/jobs/runs/get-outputendpoint is used to programmatically retrieve the output of a specific job run. - E. Incorrect.
Incorrect. While the
DELETE /api/2.1/jobs/deleteendpoint is used to delete jobs, it is not specified in this scenario that the cloned job needs to be removed.