<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: I have a notebook in workspace, how to know in which job this particular notebook is referenced. in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/i-have-a-notebook-in-workspace-how-to-know-in-which-job-this/m-p/93908#M38783</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/103205"&gt;@SS_RATH&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/115261"&gt;@TamD&lt;/a&gt;&amp;nbsp;There are couple of ways&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Call Databricks REST API&amp;nbsp;&lt;/STRONG&gt; - Use the /api/2.1/jobs/list API to list and search through all jobs. Example: -&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import requests

workspace_url = "https://&amp;lt;databricks-instance&amp;gt;"
databricks_token = "&amp;lt;your-databricks-token&amp;gt;"

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}.")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;&lt;STRONG&gt;Go to&amp;nbsp; Databricks Workspace UI&lt;/STRONG&gt; - 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"&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Panda_1-1728912669414.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/11912i3E966FCFE32EFAB1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Panda_1-1728912669414.png" alt="Panda_1-1728912669414.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Oct 2024 13:32:04 GMT</pubDate>
    <dc:creator>Panda</dc:creator>
    <dc:date>2024-10-14T13:32:04Z</dc:date>
    <item>
      <title>I have a notebook in workspace, how to know in which job this particular notebook is referenced.</title>
      <link>https://community.databricks.com/t5/data-engineering/i-have-a-notebook-in-workspace-how-to-know-in-which-job-this/m-p/65459#M32815</link>
      <description>&lt;P&gt;I have a notebook in workspace, how to know in which job this particular notebook is referenced.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 03:35:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-have-a-notebook-in-workspace-how-to-know-in-which-job-this/m-p/65459#M32815</guid>
      <dc:creator>SS_RATH</dc:creator>
      <dc:date>2024-04-04T03:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: I have a notebook in workspace, how to know in which job this particular notebook is referenced.</title>
      <link>https://community.databricks.com/t5/data-engineering/i-have-a-notebook-in-workspace-how-to-know-in-which-job-this/m-p/65468#M32819</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/103205"&gt;@SS_RATH&lt;/a&gt;, Good Day!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to inform you that there isn't a direct way to search for a job by the notebook it references. You will have to manually check each job to see which one is using the specific notebook you are interested in.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can follow these steps to find out the job which refers a specific notebook:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Navigate to the Databricks workspace.&lt;BR /&gt;2. In the sidebar, click on 'Workflows'.&lt;BR /&gt;3. In the 'Jobs' tab, you will see a list of all the jobs.&lt;BR /&gt;4. Click on the name of each job to view its details.&lt;BR /&gt;5. In the 'Job UI page', look for the 'Notebook' section under 'Task options'. This section will show the path of the notebook that is being used by the job.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.databricks.com/en/workflows/jobs/create-run-jobs.html" target="_blank"&gt;https://docs.databricks.com/en/workflows/jobs/create-run-jobs.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Or you can use the Job API to list out all the Jobs and it will give you the complete details about the Jobs present in your workspace. Please refer to this document for the same:&amp;nbsp;&lt;A href="https://docs.databricks.com/api/workspace/jobs/list" target="_blank"&gt;https://docs.databricks.com/api/workspace/jobs/list&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Please let me know if this helps and leave a like if this information is useful, followups are appreciated.&lt;BR /&gt;Kudos&lt;BR /&gt;Ayushi&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 05:36:14 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-have-a-notebook-in-workspace-how-to-know-in-which-job-this/m-p/65468#M32819</guid>
      <dc:creator>Ayushi_Suthar</dc:creator>
      <dc:date>2024-04-04T05:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: I have a notebook in workspace, how to know in which job this particular notebook is referenced.</title>
      <link>https://community.databricks.com/t5/data-engineering/i-have-a-notebook-in-workspace-how-to-know-in-which-job-this/m-p/93750#M38758</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/76914"&gt;@Ayushi_Suthar&lt;/a&gt;&amp;nbsp;I don't see "Task options" in the Job UI.&amp;nbsp; If I click on a Task, I see Task name, Type, Job, Depends on, Job parameters, Notifications, and Duration threshold.&amp;nbsp;&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/103205"&gt;@SS_RATH&lt;/a&gt;&amp;nbsp;, did you find an answer?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 03:41:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-have-a-notebook-in-workspace-how-to-know-in-which-job-this/m-p/93750#M38758</guid>
      <dc:creator>TamD</dc:creator>
      <dc:date>2024-10-14T03:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: I have a notebook in workspace, how to know in which job this particular notebook is referenced.</title>
      <link>https://community.databricks.com/t5/data-engineering/i-have-a-notebook-in-workspace-how-to-know-in-which-job-this/m-p/93908#M38783</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/103205"&gt;@SS_RATH&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/115261"&gt;@TamD&lt;/a&gt;&amp;nbsp;There are couple of ways&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Call Databricks REST API&amp;nbsp;&lt;/STRONG&gt; - Use the /api/2.1/jobs/list API to list and search through all jobs. Example: -&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import requests

workspace_url = "https://&amp;lt;databricks-instance&amp;gt;"
databricks_token = "&amp;lt;your-databricks-token&amp;gt;"

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}.")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;&lt;STRONG&gt;Go to&amp;nbsp; Databricks Workspace UI&lt;/STRONG&gt; - 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"&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Panda_1-1728912669414.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/11912i3E966FCFE32EFAB1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Panda_1-1728912669414.png" alt="Panda_1-1728912669414.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 13:32:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/i-have-a-notebook-in-workspace-how-to-know-in-which-job-this/m-p/93908#M38783</guid>
      <dc:creator>Panda</dc:creator>
      <dc:date>2024-10-14T13:32:04Z</dc:date>
    </item>
  </channel>
</rss>

