<?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: Make the job fail if a task fail in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81981#M36464</link>
    <description>&lt;P&gt;Extending to what&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/104210"&gt;@mhiltner&lt;/a&gt;&amp;nbsp;has suggested, let's &amp;nbsp;say you have 2 streaming tasks streamA and streamB. Create 2 separate tasks taskA and taskB. Each of these tasks should execute the same notebook which makes an&amp;nbsp;&lt;SPAN&gt;API call to the CANCEL RUN or CANCEL ALL RUNS OF A JOB endpoint&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;Task settings should be as follows :&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;taskA be dependent on streamA with Run if dependencies as All failed.&amp;nbsp;So taskA will only run when streamA fails.&lt;/LI&gt;&lt;LI&gt;taskB to be dependent on streamB&amp;nbsp;with Run if dependencies as All failed. So taskB will only run when streamB fails.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;So now, if streamA fails, taskA will run and cancel the run. If streamB fails, taskB will run and cancel the run.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Aug 2024 07:52:05 GMT</pubDate>
    <dc:creator>Edthehead</dc:creator>
    <dc:date>2024-08-06T07:52:05Z</dc:date>
    <item>
      <title>Make the job fail if a task fail</title>
      <link>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81583#M36349</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I have a job with 2 tasks running independently. If one of them fails, the remaining task continues to run. I would like the job to fail if any task fails.&lt;/P&gt;&lt;P&gt;Is there any way to do that?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 06:11:23 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81583#M36349</guid>
      <dc:creator>tramtran</dc:creator>
      <dc:date>2024-08-02T06:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Make the job fail if a task fail</title>
      <link>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81588#M36351</link>
      <description>&lt;P&gt;Can you share why you want that to happen? If it's a case of saving on compute, you can repair the run and only rerun the parts that failed.&lt;/P&gt;
&lt;P&gt;If you want the status code to be a failure, you could use the if/else logic with both tasks as dependents to then point to a failure script to 'fail' the final step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 07:15:32 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81588#M36351</guid>
      <dc:creator>holly</dc:creator>
      <dc:date>2024-08-02T07:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: Make the job fail if a task fail</title>
      <link>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81593#M36353</link>
      <description>&lt;P&gt;Actually, my job has multiple streaming tasks running independently. I would like to make the whole job stop if one of the streaming tasks fails.&lt;/P&gt;&lt;P&gt;For example, one of the tasks failed after 8 minutes of execution, but the others continued running for 35 hours until I found and canceled them. I would the job to fail if any task fails.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tramtran_0-1722587141935.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/10105i4EB9A65B910CB20A/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="tramtran_0-1722587141935.png" alt="tramtran_0-1722587141935.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 08:27:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81593#M36353</guid>
      <dc:creator>tramtran</dc:creator>
      <dc:date>2024-08-02T08:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Make the job fail if a task fail</title>
      <link>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81654#M36382</link>
      <description>&lt;P&gt;Unfortunately, that's not something that can be done today. It's a good idea, so I'll raise it with the product team.&lt;/P&gt;
&lt;P&gt;As for saving you 35 hours, you can set up alerting should a single task fail. The alerts can be emails, but can also be slack/teams messages or anything with a webhook. Setup docs are here:&amp;nbsp;&lt;A href="https://docs.databricks.com/en/workflows/jobs/job-notifications.html" target="_blank"&gt;https://docs.databricks.com/en/workflows/jobs/job-notifications.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 13:30:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81654#M36382</guid>
      <dc:creator>holly</dc:creator>
      <dc:date>2024-08-02T13:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Make the job fail if a task fail</title>
      <link>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81747#M36403</link>
      <description>&lt;P&gt;An idea, not sure if it helps you... You could set up a new task dependent on every other task, but with the run option set to &lt;EM&gt;"Run If at least one dependency failed"&lt;/EM&gt;. This new task would be a simple API call to the CANCEL RUN or CANCEL ALL RUNS OF A JOB endpoint. --&amp;nbsp;&lt;A href="https://docs.databricks.com/api/workspace/jobs/cancelallruns" target="_blank"&gt;https://docs.databricks.com/api/workspace/jobs/cancelallruns&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mhiltner_0-1722710662686.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/10127i7A02FB277AAF35EC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mhiltner_0-1722710662686.png" alt="mhiltner_0-1722710662686.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Aug 2024 18:45:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81747#M36403</guid>
      <dc:creator>mhiltner</dc:creator>
      <dc:date>2024-08-03T18:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Make the job fail if a task fail</title>
      <link>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81916#M36448</link>
      <description>&lt;P&gt;The problem with that is that you're dependent on the other task 'finishing' and if it's an always on streaming job, by definition it won't finish&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 15:15:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81916#M36448</guid>
      <dc:creator>holly</dc:creator>
      <dc:date>2024-08-05T15:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Make the job fail if a task fail</title>
      <link>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81981#M36464</link>
      <description>&lt;P&gt;Extending to what&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/104210"&gt;@mhiltner&lt;/a&gt;&amp;nbsp;has suggested, let's &amp;nbsp;say you have 2 streaming tasks streamA and streamB. Create 2 separate tasks taskA and taskB. Each of these tasks should execute the same notebook which makes an&amp;nbsp;&lt;SPAN&gt;API call to the CANCEL RUN or CANCEL ALL RUNS OF A JOB endpoint&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;Task settings should be as follows :&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;taskA be dependent on streamA with Run if dependencies as All failed.&amp;nbsp;So taskA will only run when streamA fails.&lt;/LI&gt;&lt;LI&gt;taskB to be dependent on streamB&amp;nbsp;with Run if dependencies as All failed. So taskB will only run when streamB fails.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;So now, if streamA fails, taskA will run and cancel the run. If streamB fails, taskB will run and cancel the run.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 07:52:05 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/make-the-job-fail-if-a-task-fail/m-p/81981#M36464</guid>
      <dc:creator>Edthehead</dc:creator>
      <dc:date>2024-08-06T07:52:05Z</dc:date>
    </item>
  </channel>
</rss>

