<?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 Catch when a notebook fails and terminate command in threaded parallel notebook run in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/catch-when-a-notebook-fails-and-terminate-command-in-threaded/m-p/23493#M16218</link>
    <description>&lt;P&gt;I have a command that is running notebooks in parallel using threading. I want the command to fail whenever one of the notebooks that is running fails. Right now it is just continuing to run the command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the command line that I'm currently running:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;q = Queue()
worker_count = 3 
&amp;nbsp;
def run_notebook(notebook):
  print(notebook)
  dbutils.notebook.run(notebook, 30, {"begin_date": begin_date, "end_date": end_date})
&amp;nbsp;
def run_tasks(function, q):
    while not q.empty():
      value = q.get()
      function(value)
      q.task_done()
&amp;nbsp;
for x in range(len(notebook_steps)): 
  for x in notebook_steps[x]:
    q.put(x)
      
  for i in range(worker_count):
    t=Thread(target=run_tasks, args=(run_notebook, q))
    t.daemon = False
    t.start()
&amp;nbsp;
  q.join()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 05 Nov 2022 19:53:52 GMT</pubDate>
    <dc:creator>cmilligan</dc:creator>
    <dc:date>2022-11-05T19:53:52Z</dc:date>
    <item>
      <title>Catch when a notebook fails and terminate command in threaded parallel notebook run</title>
      <link>https://community.databricks.com/t5/data-engineering/catch-when-a-notebook-fails-and-terminate-command-in-threaded/m-p/23493#M16218</link>
      <description>&lt;P&gt;I have a command that is running notebooks in parallel using threading. I want the command to fail whenever one of the notebooks that is running fails. Right now it is just continuing to run the command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the command line that I'm currently running:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;q = Queue()
worker_count = 3 
&amp;nbsp;
def run_notebook(notebook):
  print(notebook)
  dbutils.notebook.run(notebook, 30, {"begin_date": begin_date, "end_date": end_date})
&amp;nbsp;
def run_tasks(function, q):
    while not q.empty():
      value = q.get()
      function(value)
      q.task_done()
&amp;nbsp;
for x in range(len(notebook_steps)): 
  for x in notebook_steps[x]:
    q.put(x)
      
  for i in range(worker_count):
    t=Thread(target=run_tasks, args=(run_notebook, q))
    t.daemon = False
    t.start()
&amp;nbsp;
  q.join()&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Nov 2022 19:53:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/catch-when-a-notebook-fails-and-terminate-command-in-threaded/m-p/23493#M16218</guid>
      <dc:creator>cmilligan</dc:creator>
      <dc:date>2022-11-05T19:53:52Z</dc:date>
    </item>
  </channel>
</rss>

