<?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: How to purposely fail the notebook execution within a pipeline in Pipelines</title>
    <link>https://community.fabric.microsoft.com/t5/Pipelines/How-to-purposely-fail-the-notebook-execution-within-a-pipeline/m-p/4259668#M6083</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;- Pass your error code/text in the .exit() message.&amp;nbsp; Then read that output into a variable or IF condition in the data pipeline and if the failure condition is true use the Fail Activity to stop the pipeline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/73517846/putting-dbutils-notebook-exit-in-both-try-and-except-will-only-shows-exit-in-e" target="_blank"&gt;https://stackoverflow.com/questions/73517846/putting-dbutils-notebook-exit-in-both-try-and-except-will-only-shows-exit-in-e&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can return a JSON string from the Notebook to the Pipeline, parse it in the pipeline so you can refer to an Error Code # and Message easier than just a standard string.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Oct 2024 02:01:13 GMT</pubDate>
    <dc:creator>jwinchell40</dc:creator>
    <dc:date>2024-10-28T02:01:13Z</dc:date>
    <item>
      <title>How to purposely fail the notebook execution within a pipeline</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-to-purposely-fail-the-notebook-execution-within-a-pipeline/m-p/4254918#M6055</link>
      <description>&lt;P&gt;Salutations!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If a condition in a spark notebook is fulfilled (details not important), I want to exit the run (like with mssparkutils.notebook.exit("peekaboo!") ). I also want the pipeline which executes this notebook via the notebook activity to register this run as failed, just like if it had incidentally done so, not on purpose. How do I do that? Is it a specific exit value? Do I have to throw an exception, and if so, how would I go about that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I mean, I could put some impossible code into the notebook, but there has to be a better way, right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 18:46:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-to-purposely-fail-the-notebook-execution-within-a-pipeline/m-p/4254918#M6055</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-23T18:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to purposely fail the notebook execution within a pipeline</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-to-purposely-fail-the-notebook-execution-within-a-pipeline/m-p/4259663#M6082</link>
      <description>&lt;P&gt;&lt;FONT&gt;Hi,&amp;nbsp;Anonymous&lt;/LI-USER&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can use a Fail activity in a pipeline and customize both its error message and error code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please refer to the following documents for detailed information:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-factory/fail-activity" target="_blank"&gt;Fail activity - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2024 01:53:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-to-purposely-fail-the-notebook-execution-within-a-pipeline/m-p/4259663#M6082</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-28T01:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to purposely fail the notebook execution within a pipeline</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-to-purposely-fail-the-notebook-execution-within-a-pipeline/m-p/4259668#M6083</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;- Pass your error code/text in the .exit() message.&amp;nbsp; Then read that output into a variable or IF condition in the data pipeline and if the failure condition is true use the Fail Activity to stop the pipeline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/73517846/putting-dbutils-notebook-exit-in-both-try-and-except-will-only-shows-exit-in-e" target="_blank"&gt;https://stackoverflow.com/questions/73517846/putting-dbutils-notebook-exit-in-both-try-and-except-will-only-shows-exit-in-e&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can return a JSON string from the Notebook to the Pipeline, parse it in the pipeline so you can refer to an Error Code # and Message easier than just a standard string.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2024 02:01:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-to-purposely-fail-the-notebook-execution-within-a-pipeline/m-p/4259668#M6083</guid>
      <dc:creator>jwinchell40</dc:creator>
      <dc:date>2024-10-28T02:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to purposely fail the notebook execution within a pipeline</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-to-purposely-fail-the-notebook-execution-within-a-pipeline/m-p/4260162#M6097</link>
      <description>&lt;P&gt;That is not what I want. I want the notebook activity itself to fail.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2024 08:20:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-to-purposely-fail-the-notebook-execution-within-a-pipeline/m-p/4260162#M6097</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-28T08:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to purposely fail the notebook execution within a pipeline</title>
      <link>https://community.fabric.microsoft.com/t5/Pipelines/How-to-purposely-fail-the-notebook-execution-within-a-pipeline/m-p/4260444#M6102</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;- Ok. Then you will not be able to use .exit() but you can raise an exception to exit the Notebook.&amp;nbsp; You can pass a message back via the exception to perform additional steps if needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if var == None:
  raise Exception("No match found.")
else: 
    var2 = var&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Oct 2024 11:56:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Pipelines/How-to-purposely-fail-the-notebook-execution-within-a-pipeline/m-p/4260444#M6102</guid>
      <dc:creator>jwinchell40</dc:creator>
      <dc:date>2024-10-28T11:56:46Z</dc:date>
    </item>
  </channel>
</rss>

