Run the following commands to delete all jobs in a Databricks workspace.
- Identify the jobs to delete and list them in a text file:
%sh curl -X GET -u "Bearer: <token>" https://<databricks-instance>/api/2.0/jobs/list | grep -o -P 'job_id.{0,6}' | awk -F':' '{print $2}' >> job_id.txt
- Run the curlcommand in a loop to delete the identified jobs:
%sh while read line do job_id=$line curl -X POST -u "Bearer: <token>" https://<databricks-instance>/api/2.0/jobs/delete -d '{"job_id": '"$job_id"'}' done < job_id.txt