Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2024 06:30 AM - edited 10-14-2024 06:32 AM
@SS_RATH @TamD There are couple of ways
- Call Databricks REST API - Use the /api/2.1/jobs/list API to list and search through all jobs. Example: -
import requests
workspace_url = "https://<databricks-instance>"
databricks_token = "<your-databricks-token>"
url = f"{workspace_url}/api/2.1/jobs/list"
headers = {"Authorization": f"Bearer {databricks_token}"}
response = requests.get(url, headers=headers)
jobs = response.json().get('jobs', [])
notebook_path = "/Workspace/Users/xxx@domain.com/MyNotebook"
jobs_used_notebook = []
for job in jobs:
job_name = job.get('settings', {}).get('name', 'Unnamed Job') # Get job name
for task in job.get('settings', {}).get('tasks', []):
if task.get('notebook_task', {}).get('notebook_path') == notebook_path:
jobs_used_notebook.append({'job_id': job['job_id'], 'job_name': job_name})
if jobs_used_notebook:
for job_info in jobs_used_notebook:
print(f"Job Name: {job_info['job_name']}, Job ID: {job_info['job_id']}")
else:
print(f"No jobs found used the notebook path: {notebook_path}.")
2. Go to Databricks Workspace UI - Job Search enter your full path of the notebook Then Click serach. After result populate make sure choose your type in your case it's "Job"