如何使用 REST API 删除所有作业How to delete all jobs using the REST API
运行以下命令以删除 Azure Databricks 工作区中的所有作业。Run the following commands to delete all jobs in an Azure Databricks workspace.
标识要删除的作业,并在文本文件中列出它们:Identify the jobs to delete and list them in a text file:
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
在循环中运行
curl
命令,以删除标识的作业:Run thecurl
command in a loop to delete the identified jobs: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