BaşlayınÜcretsiz Başlayın

Delete a Databricks job

You learned how to create and run a Databricks job using the Python SDK. Sometimes there will be jobs that you previously created that are now deprecated so you want to delete them. You can use the SDK to programatically delete these jobs instead of going into the Databricks console to manually delete them. In this exercise, you will create a job and then use the SDK to delete that job.

We have already created the WorkspaceClient(), storing as w, and a notebook_path variable.

Bu egzersiz

Databricks with the Python SDK

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Create a Databricks job using the WorkspaceClient that runs on cluster_id.
  • Delete the Databricks job created in step 1.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Create a job that runs the notebook referenced in the `notebook_path` variable
created_job = w.jobs.____(name='sdk-dc-project-task',
                          tasks=[
                              jobs.Task(description="create_notebook_test",
                                        ____=cluster_id,                                         
                                        notebook_task=jobs.____(
                                            notebook_path=notebook_path),
                                        task_key="my-key")
                          ])

# Delete the job that was just created
w.jobs.____(job_id=created_job.____)
Kodu Düzenle ve Çalıştır