Problem
You notice your jobs created using Databricks Asset Bundles (DABs) are not editable in the UI. You’re unable to perform actions like Edit trigger, Pause, or Delete. The following image shows these actions grayed out in the UI.
Cause
Jobs managed by DABs are not editable in the UI for security reasons. DABs are an infrastructure-as-code (IaC) approach to managing projects, so the expectation is editing in the UI is not necessary.
Under the hood, when deploying Databricks jobs via CLI using DABs, the edit_mode
field is overridden to be UI_LOCKED
.
Solution
The edit_mode
field can be changed. You can manually override it, or make job updates programmatically using the API or SDK.
Manually override the edit mode
Access the job using the UI and click the Disconnect from source button in the header. In the following image of the UI, the button is highlighted with a green rectangle.
Then, in the popup that appears, click the red Disconnect button to confirm. This overrides the edit mode in the UI and allow changes. In the following image of the popup, the button is highlighted with a green rectangle.
Make job updates programmatically using the API or SDK
After deploying a jobs, update it using the API or SDK. Set the edit_mode
field to “EDITABLE”
within the “new_settings”
parameter.
API
You can use the following example code. For details, refer to the Update job settings partially API (AWS | Azure | GCP) documentation.
%sh
curl -X POST https://<databricks-instance/URL>/api/2.1/jobs/update \\
-H "Authorization: Bearer <your-access-token>" \\
-H "Content-Type: application/json" \\
-d '{
"job_id": <job-id>,
"new_settings": {
"edit_mode": "EDITABLE"
}
}'
Databricks SDK for Python
You can use the following example code. For details, refer to the “update” section of the w.jobs: Jobs Databricks SDK for Python documentation.
%python
from databricks.sdk import WorkspaceClient
# Initialize the client
client = WorkspaceClient(host='<databricks-instance/URL>', token='<your-access-token>')
# Update the job settings
client.jobs.update(
job_id=<your-job-id>,
new_settings={
'edit_mode': 'EDITABLE'
}
)
For more information, review the Databricks Asset Bundles resources (AWS | Azure | GCP) documentation.